This article is the first part of the BizTalk Integration pattern series. This article discusses about a simple message oriented systems pattern known as Content Enricher Pattern.
Content Enricher pattern - Setting the context...
In message oriented systems, when a message is sent from a source to the destination, it is common that the destination system requires some additional information in order to process the message correctly. The message received by the destination would contain certain "keys" or identifiers, which can be used to obtain this additional information.
- The message received by the destination is known as the "Basic Message".
- The processed message is known as the "Enriched Message".
This pattern discusses about getting that additional information and creating the "Enriched Message".
The Content Enricher uses information inside the incoming message (e.g., key fields) to retrieve data from an external source. After the Content Enricher retrieves the required data from the resource, it appends the data to the message. The original information from the incoming message may be carried over into the resulting message, or may no longer be needed, depending on the specific needs of the receiving application.
Scenario - A Purchase Order request for a Part
Consider a scenario where a Purchase Order request is made for a Part. The Order message would have the fields
QuantityRequired filled up. The Order schema would look like this...
Note: The Order XML incoming message will have only the fields
QuantityRequired filled up.
The Enricher Pattern implemented as an Orchestration
A Purchase Order request message is received by the "Receive Shape". Next, a
WebRequest message is prepared and a request is sent.
The "Enricher" in this case is a "Web Service", which takes in
PartNo and returns all the additional information required by the Orchestration.
WSPartStore port is the "Enricher" in our example. This is the external data source which provides additional information about the message.
The Web Service request has only the
PartNo filled up.
The data received from the Web Service would be used to populate the message, thus "Enriching" the message.
Executing the demo
The input XML file would have only the
QuantityRequired filled up.
The output file shall have all the fields filled up.
About the downloadable code
- Unzip the Web Service with the folder names into the C:\inetput\wwwroot directory and setup the Web Service.
- Unzip the BizTalk project zip file with the folder names in the C:\ drive.
- The folder KeyAndBindings contains the Bindings.xml file, which can be imported after the solution is built and deployed.
- Place the OrderMessage in the In folder and check the Out folder.
- Always select the "WebPortType" created when the "Web Reference" is added to the project while creating "Web Ports" in the Orchestration.
- Additional routing logic needs to be written if you would like to send the message to a different port after the
Message is populated.
- The Architecture Journal - Messaging Patterns in Service Oriented Architecture, Part 2
- Enterprise Integration Patterns
Naveen has done his Masters (M.S.) in Computer science, has started his career programming the mainframes and now has more than a decade of programming, development and design experience. Naveen has a sharp eye and keen observation skills. Naveen has worked for several companies and strived hard to build large scale business applications and bringing better solutions to the table.
Quite recently Naveen has built a fairly complex integration platform for a large bank. His hobbies include training, mentoring and research. Naveen spends his free time visiting National Parks nationwide.
Naveen has developed the BizTalk Control Center (BCC)