Try OpenEdge Now
skip to main content
BPM Events User's Guide
Event channels : The JMS event channel : JMS message adapter
 

JMS message adapter

BPM Events provides a JMS message adapter to post JMS messages to a JMS queue. A sample JMS Adapter post_po.java is as follows:
package POExampleDOM.jclass;
import com.savvion.ejb.bizpulse.manager.*;
import com.savvion.sbm.bizpulse.admin.intf.BPM EventsServerAPI;
import java.rmi.RemoteException;
import java.util.Properties;
import java.util.*;
import javax.jms.*;
public class post_po {
  /**
  * Runs this example from the command line. Example:
  * <p>
  * <tt>java post_po queueName</tt>
  * <p>
  * @param url JMS queue name like "queue1"
  */
  public static void main(String[] args) throws Exception {
      if (args.length != 1) {
          System.out.println("Usage : java post_po QueueName ");
          return ;
      }
      String queue = args[0] ;
      BPM EventsServerAPI bpc = BPM EventsClient.create() ;
      Hashtable properties = new Hashtable();
      properties.put("myJMSProp1", new Integer(1));
      String xml = new String("<?xml version=\"1.0\"?><purchaseOrder xmlns=\"http://example.com/po\"><shipTo type=\"USAddress\"><name>Fred Zoe</name><street>47 Eden Street</street><city>Santa Clara</city><state>NY</state><zip>95054</zip></shipTo><billTo type=\"USAddress\"><name>Robert Zoe</name><street>47 Eden Street</street><city>Santa Clara</city><state>NY</state><zip>95054</zip></billTo><itemsList><item partNum=\"833-AA\"><productName>Lapis necklace</productName><quantity>1</quantity><USPrice>100.00</USPrice><comment>Want this for the holidays!</comment><shipDate>2001-12-15</shipDate></item><item partNum=\"423-AA\"><productName>Baby Sound Monitor</productName><quantity>2</quantity><USPrice>49.00</USPrice><comment>Got twins!</comment><shipDate>2001-12-17</shipDate></item></itemsList></purchaseOrder>");
      bpc.postJMSMessage(properties, xml, "queue", queue) ;
  }

}
This program expects a valid JMS queue name as an argument. It instantiates a new BPM EventsClient and calls postJMSMessage() with arguments as a hashtable consisting of properties, a string XML document, type of destination that is, queue and the string JMS queue name. This posts the XML message into the given JMS queue.
* Running the sample program