org.apache.ode.bpel.iapi

## Interface MessageExchangeContext

- All Known Implementing Classes:
    MessageExchangeContextImpl, MessageExchangeContextImpl

      public interface MessageExchangeContext

  Context provided by the integration layer exposing partner communication to the BPEL engine. The BPEL engine may only invoke methods on this interface from a transactional context provided by the integration layer.

  The following partner communication scenarios are possible:

  1. partner is a accessible via a reliable transport (e.g. JMS, WS-RM)
  2. partner is accessible via an unreliable transport (e.g. HTTP)
  3. partner participates in the transaction (e.g. WS-TX)
  It is important to note that each usage scenario is identical from the point of view of the BPEL engine. However, the integration layer must handle each of these scenarios in a different manner. See the method documentation for details.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `invokePartner(PartnerRoleMessageExchange mex)` Invoke a partner.
    `void` | `onAsyncReply(MyRoleMessageExchange myRoleMex)` Method used to asynchronously deliver to the integration layer the BPEL engine's response to an invocation that could not complete synchronously.

- - ### Method Detail

    - #### invokePartner

          void invokePartner(PartnerRoleMessageExchange mex)
                      throws ContextException

      Invoke a partner. This method is invoked by the BPEL engine when an `<invoke>` construct is encountered. The BPEL engine will only invoke this method from a transactional context. This method MUST NOT block for extended periods (as it is called from within a transaction): to this end, actual invocation may be deferred or a synchronous operation may be decomposed into two asynchronous "legs". The integration layer must provide a response to the message exchange via the `PartnerRoleMessageExchange.reply(Message)`, `PartnerRoleMessageExchange.replyOneWayOk()`, `PartnerRoleMessageExchange#replyWithFailure(FailureType, String, Element)` `PartnerRoleMessageExchange.replyWithFault(javax.xml.namespace.QName, Message)`, or `PartnerRoleMessageExchange.replyAsync()` methods.

      Invocation of reliable, unreliable, and transactional transports should be treated differently. A brief description of how each of these scenarios could be handled follows.

      Reliable transports are transports such as JMS or WS-RM. For these transports, the request should be enrolled in the current transaction. This necessarily implies that the request is deferred until the transaction is committed. It follows that for reliable request-response invocations the response to the invocation will necessarily be processed in a separate transaction.

      Unreliable transports are transports such as HTTP. For these transports, where the operation is not idempotent it is typically required that "at most once" semantics are achieved. To this end the invocation could be noted and deferred until after the transaction is committed.

      Transactional transports are those transports that support transaction propagation. For these transports, the invocation can be processed immediately and the response provided to the engine via the `PartnerRoleMessageExchange.reply(Message)` method.

      Parameters:
        `mex` - engine-provided partner role message exchange representation, this object is valid only for the duration of the transaction from which the `invokePartner(PartnerRoleMessageExchange)` method is invoked
      Throws:
        `ContextException` - if the port does not support the operation

    - #### onAsyncReply

          void onAsyncReply(MyRoleMessageExchange myRoleMex)
                     throws BpelEngineException

      Method used to asynchronously deliver to the integration layer the BPEL engine's response to an invocation that could not complete synchronously.
      Throws:
        `BpelEngineException`
      See Also:
        `MyRoleMessageExchange.invoke(Message)`