Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Summary

     

In this blog I will show you how you can use the standard jms api to send a message from the mapping runtime or an adapter module to the application servers jms queues. This gives you the possibility to send asynchronous feedback during message processing.

     

Use in the message mapping

You can create a simple UDF with the message text as input parameter. The example UDF takes the parameter input of type String.

     

The call of the jms service is straight forward. You can almost copy the example code from [1]. The nice thing is that you do not have to add a user and password in  this case. The code runs in the same appserver as the jms  service so no additional authentication is needed. The provider URL is  pointing to localhost (I found that it can even be left out as well). You can  transport your code without configuring credentials.

          

The only tricky thing now is that PI does not know the jms api by default and your mapping will not compile. You can solve that problem by importing a java archive containing all the necessary interfaces. The required jar file (it is called jms.jar in the zip file) can be downloaded from sun, see [2]. Then you must setup a reference to that archive under “archives used”. Also do not forget to add javax.jms.* and javax.naming.* to your imports.

     

Now you are ready to test your code. I have setup a simple example using the well known FlightSeatAvailabilityQuery.

            

With HermesJMS you can check if everything worked out nicely, see also my previous blog [3].

General use

This code should also work from an adapter module though you might want to add the queue name as module parameter.

     

The advantage of this method compared with synchronous RFC or JDBC calls is that message processing is delayed only for a minimum amount of time. If your receiver is not reachable or the actual processing of the call does take a little longer your message processing will not be harmed. On the other hand using the application server PI is running on can have an impact on the overall performance of your PI instance.

Reference

[1] jms client example,   http://help.sap.com/saphelp_nwpi711/helpdata/en/47/4f127701fc2094e10000000a42189c/frameset.htm

[2] jms version 1.1 API Documentation http://java.sun.com/products/jms/docs.html

[3] PI and SAP application server as JMS provider, PI and SAP application server as JMS provider