Try OpenEdge Now
skip to main content
BP Server Developer's Guide
JMS based event publisher : Event sender : User-defined sender implementation
 

User-defined sender implementation

BP Server supports user-defined sender implementation. You can write a simple Java class that implements the Sender interface and add this class to the senders list specified in the property file. The EventReader passes all the events unconditionally to this class. You can specify any number of sender classes in the list.
When you write a new sender class, you can specify it as the default sender class or add it to the comma separated senders list. In the new sender class, you can handle and publish the message to a JMS or non JMS destination. The EventPublisher receives any exception raised from the sender class and initiates the shutdown process.
Business Process Server also provides utility methods to send messages directly to JMS topic or queue. You may use these utilities or write your own code to send or publish messages to JMS destinations. Use the following methods in BMJMSService in sender class to send messages to their destinations. The caller of these utility methods should have the following data ready.
*Destination Properties(jmsProps):
HashMap hm = new HashMap();
hm.put(BMJMSService.DESTINATION_NAME, "myTopic"); //must
hm.put(BMJMSService.DELIVERY_MODE, new
Integer(DeliveryMode.NON_PERSISTENT)); //optional
hm.put(BMJMSService.TIME_TO_LIVE, XXXXX); //optional
hm.put(BMJMSService.ACKNOWLEDGE, "AUTO"); //optional
hm.put(BMJMSService.USER_NAME, "username"); //optional
hm.put(BMJMSService.PASSWORD, "passwd"); //optional
*To send a message to queue or topic:
BMJMSService.self().sendMessage(Map destProps, Object msg, int msgType, selectors);
Example:
BMJMSService.self().sendMessage(hm, eventObj, BMJMSService.OBJECT_MESSAGE, selectors);
The selectors are defined for post-filter conditions described in Post-filterconditions.
*To send a message to a destination in a remote JMS Server:
In addition to the above-mentioned data, the sender code should also add the connection factory object to the name value pair.
hm.put(FACTORY_OBJECT, factoryObject);
The factory object must be of type javax.jms.ConnectionFactory.