Class 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.
    • Constructor Detail

      • MessageInjector

        public MessageInjector()
    • Method Detail

      • 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 property
        value - 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 interface org.apache.synapse.task.Task