BTT JMS invoker is used to send and receive JMS message. Because the SOA is based on ESB, and ESB is based on the message engine, BTT provides support for JMS message. You can send and receive message synchronously or subscribe inbound JMS message asynchronously by using the BTT JMS Invoker.
The message endpoint may be on the ESB or on Websphere. For the BTT JMS Invoker, the message endpoint is transparent. There is no difference between accessing both types of message endpoint. The message endpoint may be JMS topic or JMS queue.
The BTT JMS Adapter supports sending and receiving JMS message to JMS topics or queues.
The BTT JMS Adapter supports subscribing the inbound JMS message notified by other EIS asynchronously. In this way, the BTT business logic or event can be triggered asynchronously. The message endpoint from which message is subscribed may be topic or queue.
Property ID | Type | Default Value | Description |
---|---|---|---|
jmsConnectionFactoryName | String | "" (empty String) | JNDI name of JMS connection factory. |
sendDestinationName | String | "" (empty String) | JNDI name of JMS Queue or Topic to which message is sent. |
receiveDestinationName | String | "" (empty String) | JNDI name of JMS queue or Topic from which message is received. |
jmsType | String | "" (empty String) | JMS type name. |
targetFunctionName | String | "" (empty String) | Target function name of JMS. |
deliveryPersistent | Boolean | false | Whether the delivery of message is persistent. |
Following are the examples of how to use JMS invoker:
Following is the sample definition:
<JMS id="packageSend" connectionFactory="jms/TheConnectionFactory" sendDestination="PackageReceivedModule/MDBImport_SEND_D" > <parameters> <parameter id="input" /> <!-- parameter attribe ‘type’ is not needed in JMS invoker --> </parameters> </JMS>
Following is the sample code:
InvokerFactory ivf = new InvokerFactory("jar:///com/ibm/btt/ut/invoker.xml"); JMSInvoker inv =(JMSInvoker) ivf.createInvoker("packageSend"); LinkedHashMap<String,Parameter> map=inv.getParameters(); ((Parameter) map.get("input")).setValue(" outgoing message ..."); inv.execute(InvokerUtils.convertParametersToObjects(map);
Following is the sample definition:
<JMS id="packageReceive" connectionFactory="jms/TheConnectionFactory" receiveDestination="PkgRecvMod/JMSExport1_Receive_D" />
Following is the sample code:
InvokerFactory ivf = new InvokerFactory("jar:///com/ibm/btt/ut/invoker.xml"); Invoker inv = ivf.createInvoker("packageReceive"); Object result=inv.execute(null); //or use: result =inv.execute(null, 5000); System.out.println(“Message Received :”+result);
Following is the sample definition:
<JMS id="packageSendReceive" connectionFactory="jms/TheConnectionFactory" sendDestination="PkgRecvMod/JMSExport1_Receive_D" receiveDestination="PkgRecvMod/JMSExport1_Receive_D" > <parameters> <parameter id="input" /> </parameters> </JMS>
Following is the sample code:
InvokerFactory ivf = new InvokerFactory("jar:///com/ibm/btt/ut/invoker.xml"); Invoker inv = ivf.createInvoker("packageSendReceive"); String message="out going message "; Object result=inv.execute(new Object[]{message }); //or use: result =inv.execute(new Object[]{message }, 5000); System.out.println(“Message Received :”+result);
Following is the sample definition:
<JMS id="packageSendReceive" connectionFactory="jms/TheConnectionFactory" sendDestination="PkgRecvMod/JMSExport1_Receive_D" receiveDestination="PkgRecvMod/JMSExport1_Receive_D" > <parameters> <parameter id="input" /> </parameters> </JMS>
Following is the sample code:
InvokerFactory ivf = new InvokerFactory("jar:///com/ibm/btt/ut/invoker.xml"); Invoker inv = ivf.createInvoker("packageSendReceive"); String message="out going message "; inv.execute(new Object[]{message}, new myJMSCallBack(), 5000); public class MYJMSCallBack implements CallBackPoint { public void onCallBack(Object result) { // handle received JMS message System.out.println("######### JMS onMessage :"+result); } public void onError(Exception e) { // handle exception e.printStackTrace(); } public void onTimeout() { // handle timeout System.out.println("timeout"); } }
Following is the sample definition:
<JMS id="pacakgeReceive" connectionFactory="jms/TheConnectionFactory" receiveDestination="PkgRecvMod/JMSExport1_Receive_D" />
Following is the sample code:
InvokerFactory ivf = new InvokerFactory("jar:///com/ibm/btt/ut/invoker.xml"); Invoker inv = ivf.createInvoker("pacakgeReceive"); String message="out going message "; inv.execute(new Object[]{message}, new myJMSCallBack(), 0);