Package org.apache.synapse.startup.tasks
Class MessageInjector
- java.lang.Object
-
- org.apache.synapse.startup.tasks.MessageInjector
-
- All Implemented Interfaces:
ManagedLifecycle
,org.apache.synapse.task.Task
public class MessageInjector extends Object implements org.apache.synapse.task.Task, ManagedLifecycle
Injects a Message into a named sequence or a proxy service configured in the Synapse mediation engine. By default this task implementation will inject messages into the main sequence.
-
-
Field Summary
Fields Modifier and Type Field Description static String
GET_FORMAT
static String
POX_FORMAT
static String
SOAP11_FORMAT
static String
SOAP12_FORMAT
-
Constructor Summary
Constructors Constructor Description MessageInjector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRuntimeProperty(String key, Object value)
Set a property to be used at runtime.void
destroy()
Destroys the Injectorvoid
execute()
This will be invoked by the scheduler to inject the message in to the SynapseEnvironmentString
getRegistryKey()
Object
getRuntimeProperty(String key)
Get a property stored for runtime usevoid
init(SynapseEnvironment se)
Initializes the Injectorvoid
setFormat(String format)
Sets the format of the messagevoid
setInjectTo(String injectTo)
Artifact type which message should be injectedvoid
setInvokeHandlers(String invokeHandlers)
Enable / Disable invoking the handlers.void
setMessage(org.apache.axiom.om.OMElement elem)
Set the message to be injectedvoid
setProxyName(String proxyName)
Set name of the proxy service which message should be injectedvoid
setRegistryKey(String registryKey)
void
setSequenceName(String sequenceName)
Set name of the sequence which message should be injectedvoid
setSoapAction(String soapAction)
Sets the SOAPAction and valid only when the format is given as soap11void
setTo(String url)
Set the to address of the message to be injected
-
-
-
Field Detail
-
SOAP11_FORMAT
public static final String SOAP11_FORMAT
- See Also:
- Constant Field Values
-
SOAP12_FORMAT
public static final String SOAP12_FORMAT
- See Also:
- Constant Field Values
-
POX_FORMAT
public static final String POX_FORMAT
- See Also:
- Constant Field Values
-
GET_FORMAT
public static final String GET_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(SynapseEnvironment se)
Initializes the Injector- Specified by:
init
in interfaceManagedLifecycle
- Parameters:
se
- SynapseEnvironment of synapse
-
setMessage
public void setMessage(org.apache.axiom.om.OMElement elem)
Set the message to be injected- Parameters:
elem
- OMElement describing the message
-
setTo
public void setTo(String url)
Set the to address of the message to be injected- Parameters:
url
- String containing the to address
-
setFormat
public void setFormat(String format)
Sets the format of the message- Parameters:
format
- could be one of either "soap11" | "soap12" | "pox" | "get"
-
setInvokeHandlers
public void setInvokeHandlers(String invokeHandlers)
Enable / Disable invoking the handlers. Applicable only when injectTo = "sequence" | "main"- Parameters:
invokeHandlers
- should be "true" | "false"
-
setSoapAction
public void setSoapAction(String soapAction)
Sets the SOAPAction and valid only when the format is given as soap11- Parameters:
soapAction
- SOAPAction header value to be set
-
setInjectTo
public void setInjectTo(String injectTo)
Artifact type which message should be injected- Parameters:
injectTo
- Could be one of "proxy" | "sequence" | "main"
-
setSequenceName
public void setSequenceName(String sequenceName)
Set name of the sequence which message should be injected- Parameters:
sequenceName
- sequence name
-
setProxyName
public void setProxyName(String proxyName)
Set name of the proxy service which message should be injected- Parameters:
proxyName
- proxy service name
-
getRegistryKey
public String getRegistryKey()
-
setRegistryKey
public void setRegistryKey(String registryKey)
-
addRuntimeProperty
public void addRuntimeProperty(String key, Object value)
Set a property to be used at runtime. These properties will get inserted in message context created at here- Parameters:
key
- Key of the propertyvalue
- Value of the property
-
getRuntimeProperty
public Object getRuntimeProperty(String key) throws NullPointerException
Get a property stored for runtime use- Parameters:
key
- Key of the property to retrieve- Returns:
- Value of the property. If property does not exists, this will throw NullPointerException
- Throws:
NullPointerException
-
execute
public void execute()
This will be invoked by the scheduler to inject the message in to the SynapseEnvironment- Specified by:
execute
in interfaceorg.apache.synapse.task.Task
-
destroy
public void destroy()
Destroys the Injector- Specified by:
destroy
in interfaceManagedLifecycle
-
-