Implementing Adapter Inbound Message Exchange Handler - Part 4 (Consumption in BizTalk Server 2006 R2)

Using WCF LOB Adapter in BizTalk Server 2006 R2 (Inbound Scenario)

Method 1 – Content-Based Routing (No Orchestration)

 

[I will reword and extend this section later – this is my 5 minute synopsis to complete the series for testing the Adapter Inbound Handler. ]

 

In this scenario, the WCF-based Adapter hosted in BizTalk Server will listen for the messages and when the message arrives, it will send it to a file folder through the FILE adapter in BizTalk. (The irony is that the HelloWorldAdapter is actually listening on a File Folder and then generating the WCF messages for the WCF adapter, which again sends that image to the Send Port file folder. It's an expensive "file copy" operation. ;-) )

 

Build a BizTalk Project and Deploy to BizTalk Server

 

· Open Visual Studio

· Create an empty BizTalk Project

· Invoke Consume Adapter Service BizTalk Project Add-In

· Choose “Contract Type” as “Service (Inbound Operations)”

· Click on OK

· The following artifacts should be generated –

o Schema Files

o BizTalk Port Binding Configuration XML file

· Configure Project Settings

· Build and Deploy

 

Manage and configure the application in BizTalk Server

 

· Open BizTalk Administration Console

· Refresh the application you just deployed

· Create a Receive Port

o Import the BizTalk Port Binding Configuration XML file generated at design-time and located within your Visual Studio project

o This should create a Receive Port within your deployed application.

· Create a One-Way Send Port

o Use the FILE adapter

o Set the file location

o Enable content based routing using the filter

§ I used property “BTS.ReceivePortName” == “{name of my HelloWorldAdapter receive port}”. There are various others properties that can be used depending on your scenarios.

o Learn more about content-based routing here

· Start the application (ensure all the receive locations and send ports are started)

· Verify that the application receive the message

o In our sample, put the *.txt file in the folder that the WCF-based adapter is listening to. If all is configured correctly, the WCF message coming from WCF-based adapter should get routed to the output file folder specified in the Send Port.

 

Method 2 – Using BizTalk Orchestration

 

Very similar to above, except create an orchestration and ensure that all the physical ports are created and bound to the orchestration. 

 

The following sequence of events occurs if the document instance is processed successfully by BizTalk:

· The HelloWorldAdapter WCF-based adapter receives a message (as triggered by the file being dropped into the folder that’s being watched by FileSystemWatcher) and publishes it to the MessageBox as a BizTalk Message

· The orchestration subscribes to this published message so the BizTalk Messaging Engine activates an instance of the orchestration and sends the message to the orchestration instance.

· The orchestration instance publishes the message back to the MessageBox.

· The File send port subscribes to this message so BizTalk sends the message to the File adapter.

· The File Adapter writes the message containing the result set to the designated output folder.