Class AbstractMessageProcessor

  • All Implemented Interfaces:
    ManagedLifecycle, MessageProcessor, Nameable, SynapseArtifact
    Direct Known Subclasses:
    ScheduledMessageProcessor

    public abstract class AbstractMessageProcessor
    extends Object
    implements MessageProcessor
    Class AbstractMessageProcessor is handles Message processing of the messages in Message Store. Abstract Message Store is assumes that Message processors can be implemented using the quartz scheduler jobs. If in case we user wants a different implementation They can directly use MessageProcessor interface for that implementations
    • Field Detail

      • messageStore

        protected String messageStore
        Message Store associated with Message processor
      • description

        protected String description
      • fileName

        protected String fileName
      • artifactContainerName

        protected String artifactContainerName
        Name of the artifact container from which the message processor deployed
      • isEdited

        protected boolean isEdited
        Whether the message processor edited via the management console
      • targetEndpoint

        protected String targetEndpoint
        This attribute is only need for forwarding message processor. However, it here because then we don't need to implement this in sampling processor with nothing
      • parameters

        protected Map<String,​Object> parameters
        message store parameters
    • Constructor Detail

      • AbstractMessageProcessor

        public AbstractMessageProcessor()
    • Method Detail

      • init

        public void init​(SynapseEnvironment se)
        Description copied from interface: ManagedLifecycle
        This method should implement the initialization of the implemented parts of the configuration.
        Specified by:
        init in interface ManagedLifecycle
        Parameters:
        se - SynapseEnvironment to be used for initialization
      • setMessageStoreName

        public void setMessageStoreName​(String messageStore)
        Description copied from interface: MessageProcessor
        This method is used to set the associated message store of the message processor. Every message processor has to be bound to a message store
        Specified by:
        setMessageStoreName in interface MessageProcessor
        Parameters:
        messageStore - Name of this message store.
      • getMessageStoreName

        public String getMessageStoreName()
        Description copied from interface: MessageProcessor
        This method returns the associated message store name of the message processor.
        Specified by:
        getMessageStoreName in interface MessageProcessor
        Returns:
        Name of this message store.
      • setParameters

        public void setParameters​(Map<String,​Object> parameters)
        Description copied from interface: MessageProcessor
        This method is used to set configuration parameters of the message processor. For example, triggering interval retrying interval, and etc.
        Specified by:
        setParameters in interface MessageProcessor
        Parameters:
        parameters - Message processor parameters.
      • getParameters

        public Map<String,​Object> getParameters()
        Description copied from interface: MessageProcessor
        This method is used to retrieve the configuration parameters of message processor.
        Specified by:
        getParameters in interface MessageProcessor
        Returns:
        the extracted parameters of the message processor configuration
      • getName

        public String getName()
        Description copied from interface: Nameable
        Get the name of an abstraction
        Specified by:
        getName in interface Nameable
        Returns:
        String Representation of name
      • setName

        public void setName​(String name)
        Description copied from interface: Nameable
        Set the name of an abstraction
        Specified by:
        setName in interface Nameable
        Parameters:
        name - String Representation of name
      • setDescription

        public void setDescription​(String description)
        Description copied from interface: SynapseArtifact
        Set the description of the artifact
        Specified by:
        setDescription in interface SynapseArtifact
        Parameters:
        description - tobe set to the artifact
      • setFileName

        public void setFileName​(String filename)
        Description copied from interface: MessageProcessor
        This method is used to set the actual configuration file. This file has all the configuration related to particular message processor.
        Specified by:
        setFileName in interface MessageProcessor
        Parameters:
        filename - is the name of the file
      • getFileName

        public String getFileName()
        Description copied from interface: MessageProcessor
        This method is used to retrieve the configuration file name of the message processor.
        Specified by:
        getFileName in interface MessageProcessor
        Returns:
        the file name
      • setMessageConsumer

        public boolean setMessageConsumer​(MessageConsumer consumer)
        Description copied from interface: MessageProcessor
        This method is used to set the message consumer of message processor. Consumer is the one who is responsible for retrieving messages from a store.
        Specified by:
        setMessageConsumer in interface MessageProcessor
        Parameters:
        consumer - is the name of the associated message consumer
        Returns:
        is true if the message if the message consumer is returned successfully. Otherwise false.
      • setTargetEndpoint

        public void setTargetEndpoint​(String targetEndpoint)
        Description copied from interface: MessageProcessor
        This method set the target endpoint associated with the message processor. Without a target endpoint a message processor could not operated successfully.
        Specified by:
        setTargetEndpoint in interface MessageProcessor
        Parameters:
        targetEndpoint - is the name of the associated endpoint
      • getTargetEndpoint

        public String getTargetEndpoint()
        Description copied from interface: MessageProcessor
        This method is used to retrieve the associated target endpoint name of the message processor.
        Specified by:
        getTargetEndpoint in interface MessageProcessor
        Returns:
        The name of the endpoint
      • isEdited

        public boolean isEdited()
        Whether the message processor edited through the management console
        Specified by:
        isEdited in interface MessageProcessor
        Returns:
        isEdited
      • setIsEdited

        public void setIsEdited​(boolean isEdited)
        Set whether the message processor edited through the management console
        Specified by:
        setIsEdited in interface MessageProcessor
        Parameters:
        isEdited -
      • getArtifactContainerName

        public String getArtifactContainerName()
        Get the name of the artifact container from which the message processor deployed
        Specified by:
        getArtifactContainerName in interface MessageProcessor
        Returns:
        artifactContainerName
      • setArtifactContainerName

        public void setArtifactContainerName​(String artifactContainerName)
        Set the name of the artifact container from which the message processor deployed
        Specified by:
        setArtifactContainerName in interface MessageProcessor
        Parameters:
        artifactContainerName -
      • destroy

        public void destroy​(boolean preserveState)
        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.
        Parameters:
        preserveState - determine whether to preserve the artifacts state or not
      • destroy

        public void destroy​(boolean preserveState,
                            boolean isUpdate)
        Destroy the artifacts.
        Parameters:
        preserveState - whether to preserve state in registry.
        isUpdate - whether this is triggered in artifact update flow.