Skip navigation links
org.alfresco.bm.driver.event

Class AbstractEventProcessor

    • Field Detail

      • DEFAULT_CHART

        protected static final boolean DEFAULT_CHART
      • DEFAULT_AUTO_PROPAGATE_SESSION_ID

        protected static final boolean DEFAULT_AUTO_PROPAGATE_SESSION_ID
      • DEFAULT_AUTO_CLOSE_SESSION_ID

        protected static final boolean DEFAULT_AUTO_CLOSE_SESSION_ID
      • logger

        protected org.apache.commons.logging.Log logger
        Resource for derived classes to use for logging
    • Constructor Detail

      • AbstractEventProcessor

        public AbstractEventProcessor()
        Default constructor
    • Method Detail

      • setBeanName

        public void setBeanName(String beanName)
        Specified by:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware
      • getName

        public String getName()
        Specified by:
        getName in interface EventProcessor
        Returns:
        the name of the bean as configured in Spring
      • setEventName

        public void setEventName(String eventName)
        Set the single event name that this processor can handle
      • setEventNames

        public void setEventNames(List<String> eventNames)
        Set the names of the events that this processor can handle
      • getWarnDelay

        public long getWarnDelay()
        Description copied from interface: EventProcessor
        Provide a hint for the processing framework on how much time should elapse before the warnings need to be issued over the delay
        Specified by:
        getWarnDelay in interface EventProcessor
        Returns:
        the processing time after which an warning is logged (default DEFAULT_WARN_DELAY)
      • setWarnDelay

        public void setWarnDelay(long warnDelay)
        Parameters:
        warnDelay - the time allowed for processing before a warning is logged
        See Also:
        getWarnDelay()
      • isChart

        public boolean isChart()
        Description copied from interface: EventProcessor
        Hint whether the result should be included in charts
        Specified by:
        isChart in interface EventProcessor
        Returns:
        true if results from this processor must be included in generated charts
      • setChart

        public void setChart(boolean chart)
        Parameters:
        chart - true to tag results for charting
        See Also:
        isChart()
      • setAutoPropagateSessionId

        public void setAutoPropagateSessionId(boolean autoPropagateSessionId)
        Change the default session ID propagation behaviour
        Parameters:
        autoPropagateSessionId - true to propagate session IDs to the next event otherwise false (default: true)
      • setAutoCloseSessionId

        public void setAutoCloseSessionId(boolean autoCloseSessionId)
        Change the default session ID auto-close behaviour
        Parameters:
        autoCloseSessionId - true to allow the framework to aut-close sessions (default: true)
      • isAutoPropagateSessionId

        public boolean isAutoPropagateSessionId()
        Description copied from interface: EventProcessor
        Must the framework automatically carry event sessions from event to event. This is only supported where an event produces exactly one 'next' event i.e. sessions should be associated with a linear sequence of events.
        Specified by:
        isAutoPropagateSessionId in interface EventProcessor
        Returns:
        true to allow the framework to carry session IDs
      • isAutoCloseSessionId

        public boolean isAutoCloseSessionId()
        Description copied from interface: EventProcessor
        Must the framework auto-close any event sessions that cannot be propagated? This will be called if there are no further events to publish, either through an exception coming out of the processing or because an event has no further events in the chain.
        Specified by:
        isAutoCloseSessionId in interface EventProcessor
        Returns:
        true to allow the framework to automatically manage session closure
      • register

        public void register()
        Register this instance for the event names that are handled.
      • suspendTimer

        protected long suspendTimer()
        Suspend the event processing timer.
        Throws:
        IllegalStateException - if the timer is not running
      • resumeTimer

        protected long resumeTimer()
        Continue timing the event processing
        Throws:
        IllegalStateException - if the timer is is not suspended
      • stopTimer

        protected long stopTimer()
        Stop timing the event processing. This does not need to be called by derived classes.
        Throws:
        IllegalStateException - if the timer is is not running or suspended
      • processEvent

        public final EventResult processEvent(Event event,
                                              org.apache.commons.lang3.time.StopWatch stopWatch)
                                       throws Exception
        Process an event.

        NOTE: All errors are treated as terminal i.e. there will be no follow-up events published. The event and result services are provided to allow event processing to be aware of previous and future work. If the service is used to modify queues, the results could be unexpected e.g. clearing the queue will not always mean that no more events will be processed.

        Timing: Event processing can StopWatch.start() and StopWatch.stop() the timer to better reflect actual event processing.

        The implementation overrides this method to store the StopWatch in a thread-local.

        Specified by:
        processEvent in interface EventProcessor
        Parameters:
        event - the event (along with associated data)
        stopWatch - the timer that will be used or null to have one created and attached to the process automatically
        Returns:
        the result of the process (includes errors and next events)
        Throws:
        Exception
      • processEvent

        protected abstract EventResult processEvent(Event event)
                                             throws Exception
        Process an event.

        NOTE: All errors are treated as terminal i.e. there will be no follow-up events published. The event and result services are provided to allow event processing to be aware of previous and future work. If the service is used to modify queues, the results could be unexpected e.g. clearing the queue will not always mean that no more events will be processed.

        Timing: Where required, implementations can manually control the times recorded for event processing.

        Parameters:
        event - the event (along with associated data)
        Returns:
        the result of the process (includes errors and next events)
        Throws:
        Exception
        See Also:
        suspendTimer(), resumeTimer(), stopTimer()

Copyright © 2005–2018 Alfresco Software. All rights reserved.