Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When the proxy service named SMSSenderProxy receives an HTTP request, it publishes that request in a JMS queue named SMSStore. Another proxy service named SMSForwardProxy subscribes to messages published in this queue and forwards them to a back-end service named SimpleStockQuoteService. When this back-end service returns an HTTP response, internal ESB logic is used to save that message as a JMS message in a JMS queue named SMSReceiveNotification. Then this response is taken from the SMSReceiveNotification queue and delivered to the client as an HTTP message using internal ESB logic.

Info
titleThe correlation between request and response:

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 explain how to execute this use case. Here, the Message Broker Profile of WSO2 EI is used as the JMS broker.

...

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 Property mediator used in this proxy service uses the following properties:

PropertyDescription
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 Character.isJavaIdentifierPart Java method returns 'true'. Therefore when there are headers that contain special characters (e.g accept-encoding), some JMS brokers will give errors.

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.

Code Block
<property name="JMS_WAIT_REPLY" value="60000" scope="axis2"/>

The endpoint of this proxy service uses the following properties to map the proxy service with the Message Broker Profile:

...