Try OpenEdge Now
skip to main content
BP Server Developer's Guide
Messaging workstep : Message publisher workstep : Publisher message handler

Publisher message handler

For a Message Publisher workstep, user may optionally provide a Message Handler class. If no Message Handler class is provided by the user, then BP Server uses the following default Publisher Handler class: com.savvion.sbm.bizlogic.messaging.publisher.BLJMSMessagePublisher
You can implement a Custom Message Handler by using one of the following two alternatives:
*The custom Message Handler class can extend abstract class com.savvion.sbm.bizlogic.messaging.publisher.MessagePublisher
The custom handler class then has to provide implementation for the following abstract methods:
*public abstract void init();
*public abstract void destroy();
*public abstract Object createMessage() throws Exception;
*public abstract HashMap publish(Object message) throws Exception;
*The custom Message Handler class can alternatively extend class com.savvion.sbm.bizlogic.messaging.publisher.BLJMSMessagePublisher
The BLJMSMessagePublisher class already implements all the abstract methods described in the previous alternative explained above. The custom Handler class can either make use of these methods or can customize the behavior by overriding them.
The following code snippet shows a custom Handler class extending from BLJMSMessagePublisher. Please note that in the publish() method, first this we call is super.publish(), thus publishing the JMS Message and then some debug information is printed.
public class MyPublisherHandler extends BLJMSMessagePublisher {
    public HashMap publish(Object message) throws Exception {
    HashMap map = super.publish(message);
        System.out.println("Process Instance Name: " + getProcessInstanceName());
         System.out.println("Process Instance ID: " + getProcessInstanceID());
        System.out.println("WorkStep Name: " + getWorkStepName());
         return map;
When a custom Handler class is provided for a Publisher workstep, BP Server does not do anything except instantiating an object of the Handler class and invoking its methods. The responsibility of constructing the message and publishing it, lies with the Handler class. Alternatively, as shown in the above code snippet, a call to the method super.publish() publishes the JMS message, and then any additional custom logic can be added.