Running a non-interruptible process using the JMS interface

You can use the Java Message Service (JMS) interface to run non-interruptible processes.
  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. The JMSReplyToQueue value must be set.
    message.SetStringProperty("wf$verb", "call");
    message.SetStringProperty("wf$processTemplateName", "CustomerTemplate");
  4. Start the process with an input message of the appropriate type. Specify the input message as the payload of the message. When you have an array containing basic types, it is recommended that you use the Enterprise JavaBeans (EJB) interface to specify the message. This technique guarantees that the message definition is contained in the input message and that Business Process Choreographer can analyze the message.
    //Create Customer input message
    WSIFDefaultMessage input = new WSIFDefaultMessage();
    input.setObjecPart("CustomerName", "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, the result of the process, OrderNo, is returned.
    Message m = queueReceiver.receive();
    if (m instanceof ObjectMessage)
    {
    	ClientObjectWrapper wrapper = (ClientObjectWrapper)m.getObject();
    	DataObject output = (DataObject)wrapper.getObject();
      int order = output.getInt("OrderNo");
    }

Related concepts
Structure of a Business Process Choreographer JMS message
Authorization for JMS renderings