Class AbstractMessageProcessor
- java.lang.Object
-
- org.apache.synapse.message.processor.impl.AbstractMessageProcessor
-
- All Implemented Interfaces:
ManagedLifecycle
,MessageProcessor
,Nameable
,SynapseArtifact
- Direct Known Subclasses:
ScheduledMessageProcessor
public abstract class AbstractMessageProcessor extends Object implements MessageProcessor
ClassAbstractMessageProcessor
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 useMessageProcessor
interface for that implementations
-
-
Field Summary
Fields Modifier and Type Field Description protected String
artifactContainerName
Name of the artifact container from which the message processor deployedprotected SynapseConfiguration
configuration
protected String
description
protected String
fileName
protected boolean
isEdited
Whether the message processor edited via the management consoleprotected List<MessageConsumer>
messageConsumers
protected String
messageStore
Message Store associated with Message processorprotected String
name
protected Map<String,Object>
parameters
message store parametersprotected String
targetEndpoint
This attribute is only need for forwarding message processor.
-
Constructor Summary
Constructors Constructor Description AbstractMessageProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy(boolean preserveState)
Undeploy the artifact but keeps the current state based on the preserveState argument.void
destroy(boolean preserveState, boolean isUpdate)
Destroy the artifacts.String
getArtifactContainerName()
Get the name of the artifact container from which the message processor deployedString
getDescription()
Retrieves the description of the artifactString
getFileName()
This method is used to retrieve the configuration file name of the message processor.List<MessageConsumer>
getMessageConsumer()
This method retrieves the message consumer of message processor.String
getMessageStoreName()
This method returns the associated message store name of the message processor.String
getName()
Get the name of an abstractionMap<String,Object>
getParameters()
This method is used to retrieve the configuration parameters of message processor.String
getTargetEndpoint()
This method is used to retrieve the associated target endpoint name of the message processor.void
init(SynapseEnvironment se)
This method should implement the initialization of the implemented parts of the configuration.boolean
isEdited()
Whether the message processor edited through the management consolevoid
setArtifactContainerName(String artifactContainerName)
Set the name of the artifact container from which the message processor deployedvoid
setDescription(String description)
Set the description of the artifactvoid
setFileName(String filename)
This method is used to set the actual configuration file.void
setIsEdited(boolean isEdited)
Set whether the message processor edited through the management consoleboolean
setMessageConsumer(MessageConsumer consumer)
This method is used to set the message consumer of message processor.void
setMessageStoreName(String messageStore)
This method is used to set the associated message store of the message processor.void
setName(String name)
Set the name of an abstractionvoid
setParameters(Map<String,Object> parameters)
This method is used to set configuration parameters of the message processor.void
setTargetEndpoint(String targetEndpoint)
This method set the target endpoint associated with the message processor.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.synapse.ManagedLifecycle
destroy
-
Methods inherited from interface org.apache.synapse.message.processor.MessageProcessor
activate, cleanUpDeactivatedProcessors, cleanupLocalResources, deactivate, isDeactivated, isPaused, pauseService, resumeRemotely, resumeService, start, stop
-
-
-
-
Field Detail
-
messageStore
protected String messageStore
Message Store associated with Message processor
-
description
protected String description
-
name
protected String name
-
fileName
protected String fileName
-
configuration
protected SynapseConfiguration configuration
-
messageConsumers
protected List<MessageConsumer> messageConsumers
-
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
-
-
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 interfaceManagedLifecycle
- 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 interfaceMessageProcessor
- 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 interfaceMessageProcessor
- 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 interfaceMessageProcessor
- 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 interfaceMessageProcessor
- Returns:
- the extracted parameters of the message processor configuration
-
getName
public String getName()
Description copied from interface:Nameable
Get the name of an abstraction
-
setName
public void setName(String name)
Description copied from interface:Nameable
Set the name of an abstraction
-
setDescription
public void setDescription(String description)
Description copied from interface:SynapseArtifact
Set the description of the artifact- Specified by:
setDescription
in interfaceSynapseArtifact
- Parameters:
description
- tobe set to the artifact
-
getDescription
public String getDescription()
Description copied from interface:SynapseArtifact
Retrieves the description of the artifact- Specified by:
getDescription
in interfaceSynapseArtifact
- Returns:
- description of 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 interfaceMessageProcessor
- 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 interfaceMessageProcessor
- Returns:
- the file name
-
getMessageConsumer
public List<MessageConsumer> getMessageConsumer()
Description copied from interface:MessageProcessor
This method retrieves the message consumer of message processor.- Specified by:
getMessageConsumer
in interfaceMessageProcessor
- Returns:
- the message consumer
-
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 interfaceMessageProcessor
- 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 interfaceMessageProcessor
- 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 interfaceMessageProcessor
- Returns:
- The name of the endpoint
-
isEdited
public boolean isEdited()
Whether the message processor edited through the management console- Specified by:
isEdited
in interfaceMessageProcessor
- Returns:
- isEdited
-
setIsEdited
public void setIsEdited(boolean isEdited)
Set whether the message processor edited through the management console- Specified by:
setIsEdited
in interfaceMessageProcessor
- Parameters:
isEdited
-
-
getArtifactContainerName
public String getArtifactContainerName()
Get the name of the artifact container from which the message processor deployed- Specified by:
getArtifactContainerName
in interfaceMessageProcessor
- 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 interfaceMessageProcessor
- 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.
-
-