pp108 : ConsumeMessage(Deprecated)

The use of this method is deprecated. Use SendMessage instead.

ConsumeMessage(Deprecated)

This method is used to send a message to any process instance waiting on the Receive Message event. The ConsumeMessage method is part of the Process Execution 4.2 web service instance whose namespace is http://schemas.cordys.com/bpm/execution/1.0.

The ConsumeMessage method is analogous to an ExecuteProcess request for which type is set as instance and receiver as instance id. A sample request is as given below:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP:Body>
        <ExecuteProcess xmlns="http://schemas.cordys.com/bpm/execution/1.0">
            <type>instance</type>
            <receiver>{CEB228D8-5A99-48A8-9686-49FEAB32262D}</receiver>
            <message>[XML message that is waiting for Receive event.]</message>
        </ExecuteProcess>
    </SOAP:Body>
</SOAP:Envelope>

SOAP Request

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP:Body>
        <ConsumeMessage xmlns="http://schemas.cordys.com/bpm/execution/1.0">
            <receiver>PARAMETER</receiver>
            <message overwrite="false"/>
        </ConsumeMessage>
    </SOAP:Body>
</SOAP:Envelope>

Sample SOAP Request

<soapenv:Envelope xmlns:ns="http://schemas.cordys.com/bpm/execution/1.0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <ns:ConsumeMessage>
            <ns:receiver>e50664cc-7f80-4157-bcd5-0ff9d797141b</ns:receiver>
            <ns:message overwrite="false">
                <myMessage xmlns="http://schemas.cordys.com/default">
                    <element1>From Consume Message</element1>
                </myMessage>
            </ns:message>
        </ns:ConsumeMessage>
    </soapenv:Body>
</soapenv:Envelope>

Request Parameters

Parameter

Description

Data Type

receiver

This mandatory parameter is used to specify a unique identifier to the process instance i.e. process instance id of the process-instance which is waiting on Receive Message activity.

String

message

This mandatory parameter is used to provide the XML Message, on which the Receive Message Activity is waiting. The Qualified Name of the message should be same as message associated with the receive message activity.The overwrite option is used to overwrite the most recently added message in the receive message queue in case of persistent mode of receive message and message is not consumed by the receive message.Refer to Receive Message activity documentation for more details on Message Mode of Receive Message activity.

SOAP Response with example

<data>
    <ConsumeMessageResponse
        xmlns="http://schemas.cordys.com/bpm/execution/1.0" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
        <data>
            <instance_id>e50664cc-7f80-4157-bcd5-0ff9d797141b</instance_id>
            <PAGEFLOWDATA/>
        </data>
    </ConsumeMessageResponse>
</data>

Response Parameters

Parameter

Description

Data Type

instance_id

This output parameter contains the unique instance identifier for the business-process i.e. process instance id.

String

PAGEFLOWDATA

This optional output parameter contains the response message from the business-process and this is available only in case of page flow processes.

GetIntermediateMessageQueue

This Web service is used to return the Intermediate Message Queue for a given instance based on instance ID. By default, this method is open for Process Administrator Role. GetIntermediateMessageQueue is part of the Process Admin and Monitoring 4.2 web service interface whose namespace is http://schemas.cordys.com/bpm/monitoring/1.0.

SOAP Request

<GetIntermediateMessageQueue xmlns="http://schemas.cordys.com/bpm/monitoring/1.0">
    <instanceid>[Process Instance ID]</instanceid>
</GetIntermediateMessageQueue>

SOAP Response

<GetIntermediateMessageQueueResponse xmlns="http://schemas.cordys.com/bpm/monitoring/1.0">
          <intermediatemessagequeue> [One or More 'message' Element â€" 'message' element is a container for messages with same qualified name with  message-name &amp; message-namespace-uri specified in 'messageName' &amp; 'messageNamespaceURI' attributes respectively]
             <message messageName="[Message Name]" messageNamespaceURI="[Message Namespace URI]"> [One or More Messages with same Qualified Name]
             </message>
          </intermediatemessagequeue>
  </GetIntermediateMessageQueueResponse>
 Example: <GetIntermediateMessageQueueResponse xmlns="http://schemas.cordys.com/bpm/monitoring/1.0">
          <intermediatemessagequeue>
             <message messageName="myMessage" messageNamespaceURI="http://schemas.cordys.com/default">
                <myMessage xmlns="http://schemas.cordys.com/default">
                   <myElement1>Hello</myElement1>
                </myMessage>
             </message>
             <message messageName="myMessage2" messageNamespaceURI="http://schemas.cordys.com/default">
                <myMessage2 xmlns="http://schemas.cordys.com/default">
                   <myElement1>Hello</myElement1>
                </myMessage2>
                <myMessage2 xmlns="http://schemas.cordys.com/default">
                   <myElement1>Hi</myElement1>
                </myMessage2>
             </message>
          </intermediatemessagequeue>
  </GetIntermediateMessageQueueResponse>

SOAP Fault

If the process instance XML is not available in PROCESS_INSTANCE_DATA, a SOAP Fault with MessageCode Cordys.BPM.Messages.processInstanceNotFound will be displayed. This happens in the following cases:

  • Wrong Instance ID
  • Process Instance already reached to terminal status, that is COMPLETE/TERMINATED
  • Process is short lived

Related reference

Receive Message Properties Interface