Executing a non-interruptible process using JMS

Why and when to perform this task

You can use the Java Message Service (JMS) interface to run non-interruptible processes.

Steps for this task

  1. Create a message, for example, an ObjectMessage message.
    ObjectMessage message = queueSession.createObjectMessage();
  2. (Optional)   Set the JMSReplyToQueue.
    If you do not want to receive a reply, this step is optional.
    //Specify the destination object replies are to be sent to
    message.SetJMSReplyTo(replyToQueue);
  3. (Optional)   Specify the JMS properties.
    If you do not specify any properties, the process template name Dispatch is assumed. If JMSReplyToQueue is set, call is issued. If JMSReplyToQueue is not set, initiate is issued.
    message.SetStringProperty("wf$verb", "call");
    message.SetStringProperty("wf$processTemplateName", "CustomerTemplate");
  4. Start the process with an input message.
    Specify the input message as the body, the payload, of the message. In the example, Customer is a message type known to the system.
    //Create Customer input message
    Customer input = new Customer();
    input.setLastName("Smith");
    
    message.setObject(new ClientObjectWrapper(input));
    
    //Send message
    queueSender.send(message);
    This action creates an instance of the process template, CustomerTemplate, and passes some customer data. The operation returns only when the flow is complete and when a JMSReplyToQueue is specified. The result of the process, OrderNo, is returned as the payload of the reply message. Because an ObjectMessage message was passed, an object message is returned.
  5. (Optional)   Get the result of the process.
    You can get the results of the process only if you specified a queue in step 2. In the example, OrderNo is a message type known to the system.
    Message m = queueReceiver.receive();
    if (m instanceof ObjectMessage)
    {
    	ClientObjectWrapper wrapper = (ClientObjectWrapper)m.getObject();
    	OrderNo output = (OrderNo)wrapper.getObject();
    }



Searchable topic ID:   t6micexj
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/wfapi/tasks/t6micexj.html

Library | Support | Terms of Use | Feedback