BizTalk Role Link
Role links provides the layer of abstraction for the interactions between your orchestration and your partners that can be organization, department or application . It allow you to dynamically select partner to interact with based on trading partner resolution, message content, or the results of a database lookup while maintaining your overall business process intact.
Roles:
There are two roles in an orchestration
Provider: An "implements" role to receive and process messages
consumer :A "uses" role to send messages
A role link can include either a consumer or a provider role, or one of each. A consumer role consumes the services provided by the provider role.
A role link is a static configuration but is essentially a collection of ports of different adapters. For a dynamic port there is not always an explicit party concept; in a dynamic port a message is being sent from one organization to some other variable organization. And in a role link a message is either being sent or received and is then one of a collection of organizations for each endpoint. Role links are based on ports that are designated as being associated with some BizTalk party. The party can have one or more aliases which act as destination tokens when used with role link based routing.
In one way Role Links allow you to create a lookup feature within an Orchestration to determine where to send the data, and still have all of the information available to be modified through the administration console.
Scenario:
Consider you are receiving BankLoanApplication Request & based on the type of Loan(PERSONAL LOAN, HOUSING LOAN) you have to route message to that party.
We have below set of party
• Party Name : value =PartyHousingLoan & Qualifier = BankLoan
• Party Name: value = PartyPersonalLoan & Qualifier = BankLoan
For personal loan you want party "PartyPersonalLoan" will process message & for housing loan party "PartyHousingLoan" will process message.
We will use Loan Type to dynamically route our message to different party.
- Create an empty BizTalk Solution. Add a schema BankLoanApplication with nodes LoanType.
2. To make the scenario more easy & just promote LoanType as distinguished filed.
3. Add orchestration LoanProcessor to the application with receive shape( Rcv_msgBankLoanApplication) for receiving bank loan application message.
4. Create porttype FilePortType
5. Create receive port using port type fileporttype to receive bank loan application.
6. Create a Role Link type and name it ConsumerRoleLinkType as we are sending message.
7. When you expand the new link type, and right click on Role_1, it asks you to Add Port Type
8. choose the existing port type, in the Port Type Wizard
9. Rename the Role_1 to Sender
10. Create an role using wizard & use existing role link type Role_Link.ConsumerRoleLinkType
11. As we are sending message we have to select consumer.
12. Place expression shape in orchestration to set destination party dynamically
RoleLink_BankLoan(Microsoft.XLANGs.BaseTypes.DestinationParty) = new Microsoft.XLANGs.BaseTypes.Party(msgBankLoanApplication.LoanType,"BankLoan");
13. Created a send shape and connected it to the Destination Port Link
14. After deployment refresh application in console.
15. Select sender role link.
16. Right click sender role link & select properties.
17. On property window click enlist to select party involved in process.
18. Check list of party involved in process & click ok.
19.
On the property window double click party to map send port
21. Bind the party with send port & click apply.
22. Enlist & start the orchestration.
23. Submit the bank application request message at receive location.
<ns0:BankLoanApplication xmlns:ns0="http://development.rolelink.bankloanapplication/">
<ApplicationId>AppBL1001</ApplicationId>
<Name>Fredrick</Name>
<LoanAmount>1000000</LoanAmount>
<LoanType>PersonalLoan</LoanType>
<Status>Pending</Status>
</ns0:BankLoanApplication>
24. Role Links allow you to create a lookup feature within an Orchestration to determine where to send the data, and still have all of the information available to be modified through the administration console.