This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Sample 908: Inbound Endpoint with the Message Broker Profile

This sample demonstrates how one-way message bridging from JMS to HTTP can be done using the inbound JMS endpoint of the ESB. The JMS inbound protocol implementation in the ESB requires an active JMS server instance to receive the messages that will be consumed by the ESB. This sample uses the Message Broker profile of WSO2 EI as the JMS server. If you are using ActiveMQ as your JMS server, see Sample 901.

Prerequisites

  • Copy the following JAR files from the <EI_HOME>/wso2/broker/client-lib folder to the <EI_HOME>/lib folder.
    • andes-client-3.2.19.jar
    • geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
    • org.wso2.securevault-1.0.0-wso2v2.jar
  • Open the jndi.properties file from the <EI_HOME>/conf/ directory and make a reference to the Message Broker as specified below (Use carbon as the virtual host). Use either Queues or Topics.

  • Create a new sample file named synapse_sample_908.xmlwith one of the following configurations and add it to the <EI_HOME>/samples/service-bus/ directory. Select the configuration for queues, or topics, based on how you defined thejndi.properties file above.

Building the sample

Follow the steps given below.

  1. First, start the Message Broker profile of WSO2 EI. See the instructions here.
  2. Start the ESB of WSO2 EI with the sample 908 configuration. For instructions on starting a sample configuration, see Starting a sample configuration.
  3. Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.
  4. Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.

Now you have running instances of the ESB profile, the Message Broker profile, and you have a back-end service deployed in the Axis2 server. In the next section, we will send a message to the back-end service.

Executing the sample

Follow the steps given below.

  1. Open the management console using https://localhost:9446/carbon, and log in using admin as the username as well as the password. You can see that the 'jmsms' queue is created in the queue list, or that the 'mytopic' topic is created in the topic list. 

  2. Now you can publish the following message to the queue or the topic:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd">
      <soap:Header/>
      <soap:Body>
         <ser:getQuote>
            <ser:request>
               <xsd:symbol>WSO2</xsd:symbol>
            </ser:request>
         </ser:getQuote>
      </soap:Body>
    </soap:Envelope>
  3. To publish the message to the queue/topic, do the following:

    • For Queues: Click Publish Messages for the jmsms queue, copy the above message to the Message Body field, and click Send Message.

    • For Topics: Click Details of the mytopic topic, copy the above message to the Text Message field, and click Publish.

Analyzing the output

You will see that the JMS endpoint gets the message from the queue or topic and sends it to the stock quote service. You will see the following log in the terminal of the Axis2 server:

Generating quote for : WSO2