Hi All,

We had a requirement of replacing the File Adapter with the JMS adapter due to performance issues with large data.

There are many blogs which gives the information on how the JMS Adapter can be used, but here is a document which shows how you can configure it for sending CSV format file. Also the document contains sections where dynamic properties are used for sending Queue name to the MQHRF2 parameter of the IBM MQ Series.

Hope the document helps for providing more knowledge in using JMS adapter.

Requirement

To send file data using JMS to IBM MQ series Queue with CSV format.

Reason for the requirement

The scenario deals with IDoc (IDoc AAE) to File using ICO. Files were sent from PI to third Party File Server and stored in theserver. These were picked by MFT (Managed File Transfer). From MFT jobs picks the file to Datastage and send to end system. It was reported that huge files send to the target system is causing performance issues. In order to solve this issue there was a change proposed to use JMS adapter and sending the message through MQ Queue.

Existing Design

The existing design consisted of using a File Adapter been used to send a .txt file in CSV format.  The CSV format was taken care by the File Content conversion in the File adapter. The File Name was send dynamically using ASMA (Adapter Specific Messaging Attributes) with Timestamp and a custom
FileName using an Advanced UDF.

Introducing JMS adapter:

The JMS adapter (Java Message Service) enables you to connect messaging systems to the Integration Engine or the PCK.

The adapter supports the JMS specification 1.02b and 1.1.

Before you can use the JMS adapter you must first install the relevant JMS driver. The required Java libraries are product-specific and can be obtained from either the product vendor or other providers. Following installation, you must deploy the Java libraries on the J2EE server so that the JMS adapter can access the required Java classes at runtime.

If you use MQSeries 53x.xxx, you must enter the following JAR files in aii_af_jmsproviderlib.sda.

com.ibm.mq.jar

com.ibm.mqbind.jar

com.ibm.mqjms.jar

connector.jar
(use the JAR file from the J2EE client directory)

JMS adapter can be used to send xml, txt files and can also receive such formats.

Requirement Build

We had a challenge here to convert the message into a file and send in a CSV format. JMS adapter do not have standard function for File Content Conversion unlike in the File adapter.  For this we had applied modules in the Module section of the adapter. Figure 1 shows the module used to achieve this:

Figure1.png

 

Module Name

Module Key

Purpose

localejbs/AF_Modules/MessageTransformBean

XML2Plain

To convert XML to Plain flat file

The Module Key is then used with parameters to structure the Flat File and write a CSV formatted file as shown in Figure 2 and Figure 3:

/wp-content/uploads/2014/04/figure2_428619.png

/wp-content/uploads/2014/04/figure3_428620.png

There is no other configuration required in JMS adapter to convert the xml to a flat file and sending in a CSV format.

Introducing Dynamic sending of Queue Name using JMS Adapter

The Queue name which is present in the Parameters Tab of the JMS adapter can be set in the ReplyToQueue Header of the MQHRF2 filed in the IBM MQ Series. We had achieve the same with the following solution. Figure 1 shows the Module Key RFHHEADER which we have used in the below Figure 4 to send a Queue name to the header. The hided portion is the Queue Name.

/wp-content/uploads/2014/04/figure4_428622.png

Below is the Queue Name in the JMS Queue field which we will be sending dynamically to the MQ Header. Figure 5.

/wp-content/uploads/2014/04/figure5_428623.png

We need to check the ASMA properties in theChannel to have the ReplyTOQueue attribute to be send dynamically. Figure 6.

/wp-content/uploads/2014/04/figure6_428627.png

We need to mention the below parameter in the Additional Parameters section to make possible sending of attributes in a Dynamic manner. Figure 7.

/wp-content/uploads/2014/04/figure7_428645.png

File Name Creation and getting Queue Name Dynamically

The file name was to be created based on a value from the payload appended with a constant value and timestamp. As there was no feasibility of the Timestamp to be added while sending using the JMS adapter we had to use the Java functions to get the timestamp. Below figure 8 shows the
code.
Figure 8:

/wp-content/uploads/2014/04/figure8_428646.png

The next figure will explain how the ReplyToQueue attribute and the Filename were send dynamically using the UDF. DCJMSReplyTo is the name of the dynamic attribute we will be using to give the Queue Name.

In the figure there are other two attributes DCJMSMessageProperty1 and DCJMSMessageProperty0 which are also Dynamic attributes which are used as additional parameter inside the ASMA property.

Name

Technical
  Name

JMS Message Correlation ID

DCJMSCorreleationID

JMS Message Expiration

DCJMSExpiration

JMS Message Priority

DCJMSPriority

JMS Message ReplyTo Destination

DCJMSReplyTo

JMS Message Timestamp

DCJMSTimestamp

The technical names of the additional attributes are DCJMSMessageProperty0, DCJMSMessageProperty1, …, DCJMSMessageProperty9.

Figure 9:

/wp-content/uploads/2014/04/figure9_428647.png

In the below figure the Dynamic values are displayed in the Audir log of the Adapter Engine.Figure 10:

/wp-content/uploads/2014/04/figure10_428648.png

The Dynamic parameters and the values can also be seen in the SOAP definition in the Adapter Engine:Figure 11:

/wp-content/uploads/2014/04/figure11_428649.png

The below figure shows the IBM MQ series which shows the ReplyToQueue attribute having the Queue Name Figure 12:

/wp-content/uploads/2014/04/figure12_428650.png

All the Figures have been attached with this post. Please refer to attachment section.

Please Note:

We have covered the names of the Queue and specific other names due to compliance issues.

Also the Queue Name which is send in the ReplyToQueue Attribute is the name used in the JMS Receiver Channel and this is a Static Value. We cannot send and other Queue name in this attribute. The section hence covers possibilities where you can send a value to the MQHRF2 header of the IBM MQ series.

For Future References:

Below are the links which can be referred for any future knowledge:

http://www.stechno.net/sap-notes.html?view=sapnote&id=856346

http://help.sap.com/saphelp_nw04/helpdata/en/10/b1b4c8575a6e47954ad63438d303e4/content.htm

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply