Class ScheduledMessageProcessor

    • Field Detail

      • interval

        protected long interval
        The interval at which this processor runs , default value is 1000ms
      • cronExpression

        protected String cronExpression
        A cron expression to run the sampler
      • nonRetryStatusCodes

        protected String[] nonRetryStatusCodes
        This is specially used for REST scenarios where http status codes can take semantics in a RESTful architecture.
    • Constructor Detail

      • ScheduledMessageProcessor

        public ScheduledMessageProcessor()
    • Method Detail

      • getIsActivatedParamValue

        public boolean getIsActivatedParamValue()
      • isProcessorStartAsDeactivated

        protected boolean isProcessorStartAsDeactivated()
      • start

        public boolean start()
        Description copied from interface: MessageProcessor
        This method is used to start the message processor. Once the message processor is started it will start receiving messages
        Specified by:
        start in interface MessageProcessor
        Returns:
        true if successful, false otherwise
      • isDeactivated

        public boolean isDeactivated()
        Description copied from interface: MessageProcessor
        This method is used to see if the message processor is deactivated.
        Specified by:
        isDeactivated in interface MessageProcessor
        Returns:
        true if successful, false otherwise
      • stop

        public boolean stop()
        Description copied from interface: MessageProcessor
        This method is used to stop the message processor. Once the the message processor is stopped it will no longer receive messages. A stopped message processor cannot re restarted without re-instantiating.
        Specified by:
        stop in interface MessageProcessor
        Returns:
        true if successful, false otherwise
      • destroy

        public void destroy()
        Description copied from interface: ManagedLifecycle
        This method should implement the destroying of the implemented parts of the configuration.
        Specified by:
        destroy in interface ManagedLifecycle
      • destroy

        public void destroy​(boolean preserveState)
        Description copied from class: AbstractMessageProcessor
        Undeploy the artifact but keeps the current state based on the preserveState argument. if true keep the current state, else remove the state as well as the artifact.
        Overrides:
        destroy in class AbstractMessageProcessor
        Parameters:
        preserveState - determine whether to preserve the artifacts state or not
      • destroy

        public void destroy​(boolean preserveState,
                            boolean isArtifactUpdate)
        Description copied from class: AbstractMessageProcessor
        Destroy the artifacts.
        Overrides:
        destroy in class AbstractMessageProcessor
        Parameters:
        preserveState - whether to preserve state in registry.
        isArtifactUpdate - whether this is triggered in artifact update flow.
      • deactivate

        public boolean deactivate()
        Description copied from interface: MessageProcessor
        This method is used to deactivate the message processor. This will temporarily halt executing services.
        Specified by:
        deactivate in interface MessageProcessor
        Returns:
        true if successful, false otherwise
      • activate

        public boolean activate()
        Description copied from interface: MessageProcessor
        This method is used to activate a deactivated message processor. Activating message processor will cause the services to start
        Specified by:
        activate in interface MessageProcessor
        Returns:
        true if successful, false otherwise
      • pauseService

        public void pauseService()
        Description copied from interface: MessageProcessor
        This method is only used by the associated forwarding services of message processors. When the service fails to send the message to the backend it pauses the message processor and starts retrying. Pausing the message processor avoids re-triggering new services till the existing service succeed.
        Specified by:
        pauseService in interface MessageProcessor
      • resumeService

        public void resumeService()
        Description copied from interface: MessageProcessor
        This is the opposite of pauseService method. This method resumes a paused method.
        Specified by:
        resumeService in interface MessageProcessor
      • isActive

        public boolean isActive()
      • isTaskLocationKnown

        public boolean isTaskLocationKnown()
      • isPaused

        public boolean isPaused()
        Description copied from interface: MessageProcessor
        This method is used to check if the state is in paused mode.
        Specified by:
        isPaused in interface MessageProcessor
        Returns:
        returns true on success.
      • getActivated

        public boolean getActivated()
      • isThrottling

        protected boolean isThrottling​(long interval)
        nTask does not except values less than 1000 for its schedule interval. Therefore when the interval is less than 1000 ms we have to handle it as a separate case.
        Parameters:
        interval - in which scheduler triggers its job.
        Returns:
        true if it needs to run on throttle mode, false otherwise.
      • isThrottling

        public boolean isThrottling​(String cronExpression)
      • getTask

        protected abstract org.apache.synapse.task.Task getTask()
        Gives the Task instance associated with this processor.
        Returns:
        Task associated with this processor.
      • update

        public void update()
        Specified by:
        update in interface org.apache.synapse.task.TaskManagerObserver
      • cleanupLocalResources

        public void cleanupLocalResources()
        Description copied from interface: MessageProcessor
        This method is used to cleanup local resources such as JMS connections used by the message processor.
        Specified by:
        cleanupLocalResources in interface MessageProcessor