Share via


Adapter Message Exchange Handlers

A message exchange pattern describes how messages flow between two endpoints. Choosing a message exchange pattern is the first step in writing a custom transport channel. An adapter developed using the WCF LOB Adapter SDK is a custom transport channel. The following table shows the common adapter message exchange patterns to choose from when implementing an adapter to a target system.

Message Exchange Pattern

Description

Adapter Message Exchange Handler Interface

Invoked by WCF Channel Shape

 Outbound

 

"Request Response"

A response message is expected from the target system after a request has been sent by the adapter. No further messages can be sent on this thread, until the response to the request is obtained from the target system.

IOutboundHandler

 

 

IRequestChannel

Outbound with optional response

 

"Fire-and-forget Send"

 

 

In this scenario, adapter doesn’t expect a response (or an immediate response) from the target system.

IAsyncOutboundHandler

 

 

IOutputChannel

Inbound

“Receive-Reply”

This pattern consists of request-response pairs. An adapter receives a message from the target system and sends a reply.

IInboundHandler

 

 

IReplyChannel

Inbound with optional reply

 

“Fire-and-forget Receive”

As the name implies, in this scenario, the target system is not expecting a response from the adapter for a request (or event or callback) sent by it to the adapter.

IAsyncInboundHandler

 

 

IInputChannel

Duplex

 

 

 

This pattern allows an arbitrary number of messages to be sent by an adapter and received in any order. The analogy is a phone conversation where each word being spoken is a message.

** Not supported by WCF LOB Adapter SDK

IDuplexChannel

In the context of the outbound scenarios, the Client Proxy can be generated using the Add Adapter Service Reference Visual Studio Plug-In/Consume Adapter Service BizTalk Project Add-In And the inbound scenarios require Adapter Consumer to implement a Service Interface contract generated using the Add Adapter Service Reference Visual Studio Plug-In/Consume Adapter Service BizTalk Project Add-In.

Relationship with WCF Sessionful Channels

Under the hood, the Outbound Handler (and Asynchronous Outbound Handler) in the Adapter SDK implicitly creates “sessionful” channels by default due to inherent nature of adapters having a connection with a target system. This implies that the connection handle is NOT shared across different channels. Sessions are started on the client by simply creating a new sessionful channel. They are started on the adapter when the adapter receives a message on the channel. Likewise, sessions are terminated by closing or aborting a sessionful channel.

Note: Sharing a connection is not similar to re-using a connection, which continues to be supported by Connection Pool Management.

The Inbound Handler in the Adapter SDK creates a non-sessionful channel by default.

More on this topic later!