...
Info | ||
---|---|---|
| ||
Note that the message that is passed to the back-end service contains the JMS message ID. However, the back-end service is required to return the response using the JMS correlation ID. Therefore, the back-end service should be configured to copy the message ID from the request (the value of the JMSMessageID header) to the correlation ID of the response (using the JMSCorrelationID header). |
The following sub sections subsections explain how to execute this use case. Here, the Message Broker Profile of WSO2 EI is used as the JMS broker.
...
- Install WSO2 Enterprise Integrator. For information on how you can install, see the Installing the Product.
- Deploy the sample back-end service.
In this example, the
SimpleStockQuoteService
serves as the back-end service and receives the message from theSMSForwardProxy
proxy service via the JMS transport. The response sent by theSimpleStockQuoteService
is published in theSMSReceiveNotificationStore
queue that is set as the value of thetransport.jms.ReplyDestination
parameter of theSMSSenderProxy
proxy service. This allows theSMSSenderProx
y to pick the response and deliver it to the client. Follow the steps below to build and deploy theSimpleStockQuoteService
:- Open a command prompt (or a shell in Linux) and go to the
<EI_HOME>/samples/axis2Server/src/SimpleStockQuoteService
directory. Run
ant
.
- Open a command prompt (or a shell in Linux) and go to the
- Follow the steps below to enable the JMS transport of the ESB Profile to communicate with the Message Broker profile:
Edit the
<EI_HOME>/conf/axis2/axis2.xml
file, find the commented<transport receiver>
block and uncomment it as follows:Code Block language html/xml <!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x --> <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">conf/jndi.properties</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> </parameter> <parameter name="myQueueConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">conf/jndi.properties</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">conf/jndi.properties</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> </transportReceiver>
Uncomment the following
<transport sender>
block for JMS in the same file:Code Block language html/xml <!-- uncomment this and configure to use connection pools for sending messages--> <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
Info For more information on the JMS configuration parameters used in the code segments above, see JMS Connection Factory Parameters.
Open the
<EI_HOME>/conf/jndi.properties
file and update the connection factories and queues as follows:Code Block # register some connection factories # connectionfactory.[jndiname] = [ConnectionURL] connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5675' # register some queues in JNDI using the form # queue.[jndiName] = [physicalName] queue.SMSStore=SMSStore queue.SMSReceiveNotificationStore=SMSReceiveNotificationStore
- Copy the following JARs from the
<EI_HOME>/wso2/broker/client-lib
folder to the<EI_HOME>/lib
folder.andes-client-3.2.1964.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
org.wso2.securevault-1.0.0-wso2v2.jar
- Start the Message Broker Profile. For information on how to start the Message Broker Profile, see Starting the Message Broker Profile.
- Start the ESB Profile. For information on how to start the ESB Profile, see Starting the ESB Profile.
...
This proxy service accepts messages sent via the HTTP transport, and stores the messages in the SMSStore
queue in the Message Broker Profile of WSO2 EI.
The Listed below are some of the properties that can be used with the Property mediator used in this proxy service uses the following properties:
Property | Description | ||
---|---|---|---|
TRANSPORT_HEADERS | This property is used in the out sequence to make sure that transport headers (which are JMS headers in this example) are removed from the message when it is passed to the back-end client. It is recommended to set this property because (according to the JMS specification) a property name can contain any character for which the | ||
transport.jms.ContentTypeProperty | The JMS transport uses this property in the above configuration to determine the content type of the response message. If this property is not set, the JMS transport treats the incoming message as plain text. Note: When this property is used, the content type is determined by the out transport. For example, if the proxy service/API is sending a request, the endpoint reference will determine the content type. Also, if the proxy service/API is sending the response back to the client, the configuration of the service/API will determine the content type. | ||
JMS_WAIT_REPLY | This property can be used to specify how long the system should wait for the JMS queue (SMSRecieveNotification queue) to send the response back. You can add this property to the in sequence as shown below.
| ||
| This property can be set in the InSequence of the proxy service to specify the maximum time period for which a message can live without being consumed.
|
The endpoint of this proxy service uses the following properties to map the proxy service with the Message Broker Profile:
...
The SimpleStockQuoteService
sample shipped with WSO2 EI is used as the back-end service in this example. To invoke this service, the address URI of this proxy service is defined as as http://localhost:9000/services/SimpleStockQuoteServic
e.
...