BizTalk Dynamic Brokering Message Sample

This solution is a very simple Dynamic Broker message but uses a lot of interesting BizTalk Server aspects.
You can extend this idea for more complex BizTalk Server dynamic brokering solution.
In order to resolve this problem I used only BizTalk artifacts, in this case I have thought to use BRE, Business Rule Engine, that I consider to be the more interesting part to use to create a BizTalk solution based on dynamic rules.
How it works.
This example offers the possibility to send any type of information, from any type of source, simply defining the entity source and its rules of shipment dynamically.
The message is received by the receive location, this BizTalk port uses a pipeline of pass-through in order receiving any type of information, this pipeline set a property named DESTINATION, this property defines the name of the policy that will set up all the parameters of shipment.

In order to promote the property I have used the custom pipeline component named PropertyPromotionComponent, you can download this component HERE to this address, if you prefer you can develop your own component

Inside BRE I have defined the policy named FILE, that takes care to set up the shipment parameters, in this case I set a simple parameter,

In this case the rule is always true but we can extend as we prefer and this rule set the value of BaseTypeAddress field with the destination path.
I have created an orchestration that receives the messages and it takes care to set up the properties of the dynamic port, clearly we can use the same principle to change al behaviors of our process in the orchestration.

The important aspect is to call the BRE Policy dynamically, in this way we will be totally open to extend the solution.

Here the code that I have used in order to call the rule.

The rule pass the message used by the orchestration to set all of its behaviors and artifact, in this case only the dynamic port.

This example is very simple but it present the idea to create a dynamic brokering message system using a pure BizTalk Server solution.
You can use this sample and extend the idea for any type of BizTalk dynamic solutions.

Share this:

Like this:

Related

14 comments

i have flat file, it contains more than 10,000 records, i used receive pipe line decode stage (custom pipe line to update the flat file name) and flat file disassemble to disassemble the message.

Question, end of the last line in the flat file or last message, i want to call custom .net code to generate pdf report and send to email.
I am new for BizTalk, my orchestrations are like , port to receive -> receive message -> insert record -> if i put send message here, it is creating 10,000 pdfs and emails.

I Mak,
don’t make send operation or same stuff fro a pipeline internally, this is wrong, because you work out of a BizTalk concept and control.
Organize the solution in different subscriber processes, one for the debatch and one to send the email
don’t send messages from BizTalk using c# coding because you will be out of the scope of BizTalk Server
Let me know

May be i am not mentioned it clearly. My .net code will create PDF report and attached to email. so i want to call this function at the end of flat file process (like end of 10000th line). Qns How do i know which is last transaction to kickstart the PDF generation function?

i did it this way, i got total record in the decode pipeline stage, then promote to inmsg.Context.Promote(“TotalRecord”, propertySchema, count); , then i wrote .net helper function to increment the record number (static) and check the record number is equal to total record. if it is same then i call ssrs report and send to email.

Hi Nino,
Thank you for sharing this post.
I think there is not a way to use a totally dynamic broker using a pure BizTalk Server solution.
Your provided solution will work in case it is only file endpoint with different address locations but what about other adapters ftp,sftp,,,,etc?
What if each destination use different adapter?
How it will be handled with a pure BizTalk Server Solution?
You have to have something like ESB Toolkits.
Regards,
Suleiman shakhtour

Hi, good question, there are some different approaches, .Net, Reflection and Abstraction, injection, all of them applicable in a lot of different place, pipeline, map,bre,orchestration.
This will be one of the topics in BizTalk Summit 2014 London http://www.biztalk360.com/BizTalk-Summit-2014/index.html , for me the ESB Toolkit is a pure BizTalk solution (I call them T-ready ), ready to create a ESB concept BTS solution in more simple mode, but we could create all of this with our hands without any problem.

i did it this way, i got total record in the decode pipeline stage, then promote to inmsg.Context.Promote(“TotalRecord”, propertySchema, count); , then i wrote .net helper function to increment the record number (static) and check the record number is equal to total record. if it is same then i call ssrs report and send to email.

Hi Fernando, we can use, we must to use, the BRE everywhere in BizTalk, some places are better than other, the pipeline component is one of the most critical place in BizTalk, for a lot of reasons,, but if you prefer you can do the same everywhere in BizTalk, in mapping too🙂

Thanks Nino, I work with BTS since version 2000 but I stopped qlmost dev activity on 2010. I am restarting now and evaluating BTS 2K13. I wactehd your session of London summit 2013 around your document Arch adn assessment review, it is of great help. Recently, I have a freind who owns a company where they heavily use BTS 2K10. He requested me to review their implementations. I have discovered so many irregularities from best practices perspective. I don²t have a lot of time to sepend for him, what would you do or what would look at firstly in this type of mission. They have a duplicated BT applications on 3 different platfoms with different configuration.

So now, regarding the cs file you have semd me, the namespace is Aldermore.ESB.Common.Pipeline wheras in your project “DynamicBroker, there is a missing reference to a class named Tamoil.EAI.Common.Pipeline. What is the best route to setup the environment correctly/

Another question regarding your 3 blogs around High Availability Test Plan, have you ever or have you writien a test plan and test scaniros using Visual Studio User stories and MTM in agile methodology for a standard Biztalk solution with 1 project for Maps, 1 for shcemas, 1 for orchestration…….
I undesrtand and have done some unit testing for schemas, maps and pipelines but not orchestration and would like to see if there is somewhere somebody whos has written some user stories followed by a Test plan and scenarios.
Also, When I used to work on BTS 2K10, 2009, 2006R2, I really suffered from testing orchestration, according to your experience, what is the best route to do different level of testing, if there is for orchestrations apart from full integration and running the orchestration?