Terminating a process instance using the JMS interface

Sometimes it is necessary for someone with process administrator rights to terminate a process instance that is known to be in an unrecoverable state. For example, when an application is invoked and fails and does not return to a dormant state.

It is recommended that you terminate a process instance only in exceptional situations. The process instance is terminated immediately without waiting for any outstanding subprocesses or activities. Process instances that are terminated using the Java Message Service (JMS) interface are not compensated.

  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. Set the JMS properties.
    message.SetStringProperty("wf$verb", "forceTerminate");
    message.SetStringProperty("wf$processInstanceName", "CustomerOrder");
  4. Terminate the CustomerOrder process instance.
    // Send message
    queueSender.send(message);
    The process instance is terminated immediately without waiting for any outstanding subprocesses or activities. If the JMSReplyToQueue value is set, this action returns an empty reply message if the process instance was terminated successfully. The JMSCorrelationID value is set to the JMSMessageID value of the forceTerminate request. Neither properties nor payload are set on the reply message.