Hi
Everyone, In this post I will show how to configure the Filter Expression
property of a Receive Shape, so that based on the value of the incoming message,
particular orchestration will be started.
This
application is based on the one of my requirement in office as we had to
re-use the schemas for different business purposes.
In
this application there are two Orchestration and based on the value of one of
the element from the Incoming message (this value is to be property promoted)
respective Orchestration is fired.
If
the value of the NotificationReceiver is 1 THEN Orchestration 1 will be Fired
If
the value of the NotificationReceiver is 2 THEN Orchestration 2 will be Fired
Create Business Schema in a new
Project as shown below –
Do
Property Promotion for the Node NotificationReceiver,
as this node will be the one used to promote the decide the Orchestration
to be fired.
Create Property Schema from New Items – Name
the Property Schema – Add two Elements in the Property schema as – NotificationSenderProp and NotificationReceiverProp and promote
the properties NotificationReceiver and NotificationSender from the business schema
Create Two Orchestration in one
Project as shown below –
Note – Add
Reference to the Schema's project and message type of the created schema above
BizTalk
Orchestration1.odx
|
Expression in the
Event Logging (This expression is for our reference to know the Orchestration
being fired)
|
System.Diagnostics.EventLog.WriteEntry("Orchestration
1 started - Notification Sender is 1","Orchestration 1");
|
Then
click on the Receive Shape and Select Activate Property to True, This will
enable – Filter Expression property
– Select the Property Element which will be evaluated and if found true then it
will start the Orchestration
(PromotedPropertiesSchema.NotificationReceiveProp
==1)
When
we build with this we get the following error – illegal ‘activate’ predicate
To
solve this go to the filter expression editor and for the value to be compared
put double quotes as below
This
will generate as –
(PromotedPropertiesSchema.NotificationReceiveProp
== "1")
DEVELOP
ANOTHER ORCHESTRATION (BizTalk
Orchestration2.odx) WITH THE SAME STEPS but with Filter value as - (PromotedPropertiesSchema.NotificationReceiveProp
== "2")
Now to test it Drop an XML with the
NotificationReceiver value to 1 then Orchestration 1 will be started and an
event Log will be written.
Again Drop an XML with the
NotificationReceiver value to 2 then Orchestration 2 will be started
Links –
1) How to Configure the Receive Shape
1) How to Configure the Receive Shape
2) Using Filters With the Receive Message Shape
https://msdn.microsoft.com/en-us/library/aa560178.aspx
XSD Views of the Schema
|
PromotedReceiveSchema.xsd
|
<?xml
version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://PromotedPropertiesSchema.PromotedReceiveSchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="https://PromotedPropertiesSchema.ReceivePropertySchema" targetNamespace="http://PromotedPropertiesSchema.PromotedReceiveSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:imports>
<b:namespace prefix="ns0" uri="https://PromotedPropertiesSchema.ReceivePropertySchema" location=".\ReceivePropertySchema.xsd" />
</b:imports>
</xs:appinfo>
</xs:annotation>
<xs:element name="MainRoot">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property name="ns0:NotificationReceiveProp" xpath="/*[local-name()='MainRoot'
and namespace-uri()='http://PromotedPropertiesSchema.PromotedReceiveSchema']/*[local-name()='NotificationReceiver'
and namespace-uri()='']" />
<b:property name="ns0:NotificationSenderProp" xpath="/*[local-name()='MainRoot'
and namespace-uri()='http://PromotedPropertiesSchema.PromotedReceiveSchema']/*[local-name()='NotificationSender'
and namespace-uri()='']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="NotificationReceiver" type="xs:string" />
<xs:element name="NotificationSender" type="xs:string" />
<xs:element name="NotificationNo" type="xs:string" />
<xs:element name="ChildRecord">
<xs:complexType>
<xs:sequence>
<xs:element name="Details1" type="xs:string" />
<xs:element name="Details2" type="xs:string" />
<xs:element name="Details3" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
|
ReceivePropertySchema.xsd
|
<?xml
version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://PromotedPropertiesSchema.ReceivePropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="https://PromotedPropertiesSchema.ReceivePropertySchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="NotificationSenderProp" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="7f345e1a-e8dd-428a-8d19-b882834c18f2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="NotificationReceiveProp" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="7e9f4475-464b-4b3c-8c67-0abd1501436f" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>
|
No comments:
Post a Comment