Blogging BizTalk

Lets Discuss BizTalk

Tag Archives: biztalk

Understanding Bussiness Rules Engine Via The Dynamic Endpoint Resolver Pattern


In this example I am going to demo how we can use Business rules engine in BizTalk to route messages dynamically.

Here is our scenario.

We receive a message having a node called PartyName.

Based on the value of PartyName the business rules policy named ‘ResolverRules’ will fetch the endpoint and adaptertype from from a SQL table named ‘RulesResolver’.This policy will be called from an orchestration which will use a dynamic send port based on the endpoint fetched by the rules.

Advantage: This will help us accomplish a decoupled messaging scenario. All we need to do is add the new PartyName and the corresponding endpoints, adapterUsed information in the SQL table and the orchestration dynamic send port will take care of the routing. Which essentially means a single send port can cater to multiple send end points.

DEMO:

STEP1: CREATING THE RULE

Create a DB and table in your SQL server. The table will have three columns for partyname adapter type and end point. Our orchestration will fetch all these information via the rules engine and assign it to the dynamic send port properties. Our table is going to look something like this.

DBTable

Open the Business Rules Composer.

Go to the facts explorer > Vocabularies tab> Select Vocabularies, right click and pick Add New Vocabularies.

Name your vocabulary as appropriate. Click on your newly created vocabulary and pick  Add new definition. We are going to define two definition one will fetch our endpoint and other will fetch the PartyName.

SetVocabulary

Once done right click on your vocabulary version and pick Publish. Without publishing the vocabulary we wont be able to use that in our rules policy. Also once the vocabulary is published it cannot be modified.If need arises we will have to publish a new version and use that instead.

VocabularyPublish

Now once vocabulary is ready we are going to create rules policy based on the DB facts and the XSD. To reference our xsd we will select the XML schemas tab and right click on schemas > Browse to our xsd file we have created in the BizTalk solution also holding our orchestration.

setxml

We are now ready to define our rules policy now. Click on policies and pick add new policy. Name it appropriately. After you are done configuring your policy the end result should look like this. The conditions we have defined has used the vocabularies we defined in the earlier step.

Please go ahead and deploy the policy.Without deploying the orchestration will not pick the rules.

policy

Now our Rules Policy is ready to be used.

STEP 2: CREATING THE ORCCHESTRATION TO CALL RULES.

Please create an orchestration looking ressembling following picture .

Orchestration

You will have to add System.data, System.transaction and Microsoft.RulesEngine reference  in the solution. Create three variable in the transaction scope of the call rule shape of the following types.

Microsoft.RuleEngine.DataConnection
System.Data.SqlClient.SqlConnection
System.Data.SqlClient.SqlTransaction

The expression shape in the orchestration are going to look like this.
orchexpressions

Use the call rule shape to point to our rules policy. Configure the input parameters, in this case two one message and other rules connection.

The last send port is dynamic and we will pass the port parameters in the last expression shape which in turn are derived from the message returned by rules policy. Notice the expression to assign the end point.

Now we can deploy this and our solution will be ready for testing.

Please leave me a comment if you have any questions.

Advertisements

Orchestration To Orchestration Call Via Direct Bound Ports For A Synchronous Process


This is a demo for calling one orchestration from another orchestration via direct bound port. Please note there is a strong binding between receiver and sender orchestrations hence if the receiver orchestration contracts or version changes at any point of time you will have to incorporate that in your sender orchestration as well.

Scenario: The main orchestration calls the sub orchestration and waits upon the reply to come back from sub orchestration to continue further.

Logic Behind: The main orchestration refers to the contract of the suborchestration via an assembly or directly (as I have done in this example). The main orchestration passes a unique promoted property to the sub orchestration(It can be a set of properties as well).Please ensure whatever property you are promoting has to be unique for each instance of the calling orchestration. The sub orchestration does its flow and before sending back the response it also returns the promoted property written in context of its response, back to the main orchestration. Now the main orchestration has a receive port listening on the sub orchestration response, it is following a correllationSet defined for the promoted property. Confused ? Ok, lets  walk through on how this has been implemented from coding perspective and I hope you will know what I am trying to explain.

1>Create a new BizTalk project and add two orchestration files there.

  • MainOrchestration.odx
  • SubOrchestration.odx

Define the request and response schemas for each of the orchestration. The body of the orchestration will look like this. I am not doing any complex logic here. The main orchestration creates the sub orchestration request>> sends it to the messegebox>> pick up the response from the message box>>creates its own response and sends it to a file send location. The main orchestration body will look like this.

Image

2>We need to assign a unique property to the sub orchestration request message. I have created a property schema and will be using it to define my correlation property.

New1

3>Since this unique property has to be available in the context of the sub orchestration request message it has to be promoted , we accomplish this by creating a new correlation set with the identified unique property.

4>Initialize this correlation set on the send shape for sending sub orchestration request and follow it on receive shape for the sub orchestration response.

write the remaining portion of Main Orchestration and you are done with it here.

5>The sub orchestration will look like this.

Image

6>Since the sub orchestration needs to return the property which was sent by the main orchestration here also you need to create another promoted property used to store the value sent by main orchestration.

Image

=Please note all the ports used to communicate with the sub orchestration is of direct binding type( Silly to mention but that is what I have designed this solution around)

Create a file receive port and trigger your orchestration. You should be able to see the following execution.This completes the demo. Please leave me a comment if you need some clarification or help. I will get back ASAP. Thanks.

OrchestrationExecution

Sequential Convoys / Singleton Orchestration In BizTalk Demo


A sequential convoy enables multiple single messages to join together to achieve a required result. A sequential convoy is a set of related messages that have a predefined order. Although the messages do not have to be exactly the same, BizTalk Server must receive them in a sequential order.

Few usage of them could be an aggregator orchestration or to introduce throttling. I will be covering those in later blogs.

In our example below all the messages arriving to one ReceivePort will trigger our orchestraion and all of them will be consumed within a SINGLE INSTANCE of the orchestration. In other words each incoming message is not triggering a new orchestration instance. I have tried to keep the orchestration simple but hopefully by the time you will finish reading this you will know what how the sequential convoys operate.

Using correlated Receive ports are key to sequential convoys. Here are the steps.

1>Create a new BizTalk solution and define your incoming and outgoing message schemas(You can refer to my previous posts in case you want to for doing that)

2>Add a new orchestration to your solution and design it similar to the Picture below.

SCOrchestration

3>Define correlation set and types and in the correlation properties we will use the “BTS.ReceivePortName” property since we want to have the convoy configured on all the messages arriving on a particular receive port.

correlation

Note:We can use a lot of other properties to define the “correlation ” for the sake of simplicity I have picked ReceivePortName.Let me know if you want to use some other properties and discuss it here.

4>On the first receive shape we will initialize this correlation set.

IntializeCorr

5>The second receive shape will follow this correlation set.

followcorr

6>Create a physical receive port and send port. Bind orchestration and start all the ports, orchestration

When the first message arrives in the message box the orchestration picks that up and starts while initializing the correlation, when the 2nd message arrives instead of being subscribed for a new orchestration instance it rather goes to the 2nd receive shape which is following the correlation initialized by the first receive shape hence this message gets consumed by the existing orchestration instance. This loop goes on unless we write a logic for when to break it.

Try dropping xml files to your receive location, the admin console will show you all the artifacts triggered notice there is only on orchestration instance triggered. During the time when there are no messages coming into the receive location or orchestration will be in dehydrated state and and will rehydrate in event of a new message arriving into the port. Also this orchestration is not designed to complete, you may want to add a branch with delay shape to exit the infinite loop in the code, anyways thats a simple thing to do and we may handle this in mutiple way. Hope the example comes handy.

SeqAdminConsole

Need source code, please drop a comment with your email id and I will revert back ASAP.

Microsoft Azure : Creating Your Own BizTalk SandBox Virtual Machine..


Update 12/2016: With release of BizTalk 2016 the Azure interface has changed. The image for BizTalk 2013 R2 is only available in Azure Classic portal, for the latest Azure portal you will get BizTalk 2016, having said that rest of the process stays pretty much the same.

 

Like the name says this post will aquatint you on how you can have your own VM hosting BizTalk server which can be used for your own development efforts. Sounds cool, I know it is 🙂

The starting point will be the following link.

http://azure.microsoft.com/en-us/pricing/free-trial/?WT.mc_id=azurebg_us_sem_google_br_top_nontest_trialpage_microsoftazure&WT.srch=1

Follow the prompts and you shall be able to get something like below eventually : your own VM with BizTalk preconfigured and ready to be used.

Original - Copy

If you chose BizTalk Server Enterprise or Standard, then You must provision another VM of SQL Server to use with those BizTalk VM’s.

Only the MSDN Developer editions of BizTalk VM’s include the full stack, including SQL Server and Visual Studio.

It might take about 10 to 15 minutes and once it completed you can download the rdp file which will use the windows remote desktop connection and launch your own BizTalk box.

Note:

After creating the BizTalk box you may get the RDC issue while trying to access your VM : Remote Desktop can’t connect to the remote computer for one of these reasons.

You may face this problem if you are in your work LAN network. Configure different public port for the RDP Endpoint. Setting it to 443 (the HTTPS Standard port) or 22 (Standard SSH port) will solve the issue

Original2

ESB/BizTalk Installation Error: Check that SSO is configured and that the SSO service is running on that server. (RPC: 0x800706D9: There are no more endpoints available from the endpoint mapper


You can get this error under while configuring BizTalk server or ESB.SSOError

To fix this error we need to go to the windows service

Solution: Go to windows services: Check Enterprise Single Sign On Service is running or not if not start it. Please do the same with Remote Procedure Call (RPC).

SSOStop

BizTalk Error “A Correlation Set Can Be initialized Only Once” : An alternative solution


So you bumped into this error while compiling your BizTalk project. The most obvious reason could be : You have a correlation set set initialized on more than one places by mistake.

Now here is the tricky part: What if you have initialized it only once but still you are getting this error. What could be wrong.

Here are the possible reason:
You are using a long running transaction loop (For example in the resume pattern : https://psrathoud.wordpress.com/2014/02/01/understanding-resume-pattern-in-biztalk/) and have initialized this correlation set in there ONCE :-). You see, even thou it is initialized once at run time it may be called more than one time, thus explaining the error.

Solution:
You need to define your correlation set in a non long running scope contained within your long running scope and that will fix the problem for you.

Let me know if you have questions.

Thanks
Pushpendra

Error Message Routing Pattern demo In BizTalk


This topic deals with Error Message Routing Pattern Demo.

Where can you use this? One of the examples may be when your send port end point is erroring out or the subscriber to a RP is unavailable for some reason(For example may be a a send port working in a time window) then you will bump into a scenario where in a message comes in on a receive port and doesn’t finds a subscriber which it would have had it come between the defined time window or  where you may see the Zombie message scenario (Let me accept it is not a very ideal solution to handle the Zombies but may fit your need, one never knows).   It is going to leave you unconsumed messages suspended messages in BizTalk, if you choose to terminate them it can lead to data loss scenario . Even if you resume these messages they going to suspend back because there instance subscription is no longer valid(In case the response was to consumed by orchestration). You may want to handle them and this is one of the way on How can you do it.

I am trying to demo how can handle this.

Lets Create The Non Subscribed Orphaned Message Scenario

1>Create a receive port with the “Enable Routing Failure For Failed Message” ticked in.

RcvPort

2>when you drop a message which has the subscriber defined it will be consumed by the respective BizTalk artifact. Now if you drop a message which has no subscriber defined: You will have a suspended message with no subscriber found error. So you have your orphaned message created at this point in time.
Read more of this post

Error: Cannot perform encryption or decryption because the secret is not available from the master secret server. See the event log for related errors.


So, BizTalk is stalled, processing  nothing and we see this error:

The Messaging Engine failed to retrieve the configuration from the database. Details:”c0002a1f”.

If you look up the events it will have more audit entries, one may read following.

Cannot perform encryption or decryption because the secret is not available from the master secret server. See the event log for related errors.

This message tells there is something wrong with the ESSO .

Based on that first we shall go and check for the ESSO service to see if it is in started state.

Note: You may need to see where your ESSO service is configured. In real world scenario the BizTalk msgBox DB is hosted on a separate SQL server and that’s where your ESSO may be configured.

Now suppose if you are unsure of your ESSO server name here is what you should do: On the BizTalk server box  go to services and restart the Enterprise Single Sign On Service. This will not fix the problem for you but will give the name of your ESSO server. There will be an event log entry created with the details.

FindSSO Server

Now once we have identified the SSO server name please check if the SSO service is running. If that looks OK you will be required to restore the SSO.

Go To SSO Adminnistration -> System -> Restore Secret and select the secret file.

It will be available on following location in ESSO server C:\Program Files\Common Files\Enterprise Single Sign-On”.

Select the .bak file and provide the password.

restore

This should possibly resolve the issue.

Error : The following items could not be matched up to hosts due to name and/or trust level mismatches


While trying to import the bindings you bumped into following error:

The following items could not be matched up to hosts due to name and/or trust level mismatches:
TITLE: Import Bindings
——————————
Failed to update binding information. (mscorlib)
——————————
ADDITIONAL INFORMATION:
Cannot update send port “***************************”. (Microsoft.BizTalk.Deployment)
——————————
Cannot update transport information (address “**********”). (Microsoft.BizTalk.Deployment)
——————————
he following items could not be matched up to hosts due to name and/or trust level mismatches: 
Item: ‘FILE’ Host: ‘YourHostName’ Trust level: ‘Untrusted’
You must do one of the following:
1) Create hosts with these names and trust levels and try again
2) Re-export the MSI without the binding files and have a post import script apply a suitable binding file. (Microsoft.BizTalk.Deployment)
There could be two reasons behind this.
1>Check for the name of host. Make sure the spelling matches with what has been provided in the binding file. If there is a mismatch then either change the name in your binding file or correct it on you host name.
2>Check for the receive and send handlers on the adapter settings.Check  on the binding file and see what handler is being used there, once identified go to the adapter settings and look if the handler is created.
 For example
This is the part of the binding file script
<SendHandler Name=”YourAdapterHost” HostTrusted=”false”>
          <TransportType Name=”FILE” Capabilities=”11″ ConfigurationClsid=”” />
  </SendHandler>
This line indicates that in the file adapter we should have a send handler created under the YourAdapterHost. Verify it by going to the adapters on admin console and if the handler is not present we need to create it. See the image below.
AddHandler
 Please leave me a comment if you have any questions
D Goins Insperience

Technological outformation for this day and age

[INACTIVE BLOG] Connected Thoughts - Thiago Almeida

Connected systems and the occasional picture

Uri Katsir's Blog

BizTalk , BizTalk RFID and .NET

prashantbiztalkblogs

My BizTalk Experiences

BizTalk Server Tutorial

BizTalk Server Concepts and Common Errors

Extremely Talented Monkeys

A Technical Blog by Ed Jones: Azure, .NET, BizTalk, WCF, and SQL Server

On All Things Web

Discussing web development without limits

Vikas Bhardwaj's Blog

Articles about BizTalk Server and .NET C#

Cloud develop

a blog about (cloud) development... because I'm a nerd

Hooking Stuffs Together

My learning logs from day to day work experience about Integration platform using Microsoft technologies.

Connected Pawns

Mainly BizTalk & Little Chess

jhelatissimo

a blogger in the process.

MS Innovations Blog

Tips, Tricks, and Workarounds for BizTalk and other Microsoft technologies

srirambiztalks

Katradhu Kaialavu,Kalladhadhu Ulagalavu!

Vijay Microsoft Technical

BizTalk, WCF, ESB ToolKit, Windows Azure

Mind Over Messaging

Musings on BizTalk, Azure, and Enterprise Integration