How to Add a Filter to a Send Port for Content-Based Routing Using BizTalk Explorer

You can use BizTalk Explorer to create one or more filter expressions using any properties in the message context. The combined expressions filter messages to a send port or a send port group. A filter does not affect the messages that an orchestration sends to the port; it creates an additional source for messages that does not use orchestrations and is particularly helpful in a messaging only or pass-through scenario, when an orchestration is not necessary. In addition, you can define a filter expression that sets conditions for the properties or message fields to determine the messages you want to receive.

For more information about the message context properties that you can promote, see Message Context Properties.

Aa547903.note(en-us,BTS.20).gifNote
BizTalk Explorer does not perform type validation on the filter expression. The engine throws an exception if it encounters a type that is not valid when the send port starts.

To add a filter to a send port

  1. In Visual Studio 2005, in a BizTalk Server project, on the View menu, click BizTalk Explorer.

  2. In BizTalk Explorer, expand the Send Ports collection, right-click the send port to which you want to add a filter, and then click Edit.

  3. In the Send Port Properties dialog box, expand the Filters & Mapping folder in the left pane, and then select the Filters node.

    The expression pane displays an empty grid where you can add expressions. In each expression, you compare a message property with a constant. You can change the order in which BizTalk Server evaluates the expressions and how it groups them into the final filter. To view the results of your work, click Show Filter Expression on the toolbar.

    Aa547903.note(en-us,BTS.20).gifNote
    When you create a subscription, BizTalk Server maps decimal values entered in the Value column for an integer property to an integer. BizTalk Server rounds the decimal value to the nearest integer, for example, a value of 9.4 is mapped to 9, a value of 9.5 or 9.9 is mapped to 10.

    Aa547903.note(en-us,BTS.20).gifNote
    Time values entered in the Value column for a datetime property must be expressed in .NET-supported time formats. For more information about .NET-supported time formats, see "DateTimeFormatInfo Class" in .NET Frameworks Help.

  4. In the expression pane on the right, click Click here to add a new row to add a property, operator, value, and group by value to your expression. For example, to subscribe to the messages from a receive port (recPort1), enter the following expression.

    BTS.ReceivePortName == recPort1 
    Illustrates the send port filter.
    Send Port Properties, showing send port filter
    Aa547903.note(en-us,BTS.20).gifNote
    Filter expressions in send ports should not include double quotation marks around the value. This is unlike filters in orchestrations, which require the value to have double quotation marks around it. If configured for use in an orchestration filter, the example shown previously would be the following.

    Aa547903.note(en-us,BTS.20).gifNote
    BTS.ReceivePortName == "recPort1"

    For information about writing expressions and using the Expression Editor, see XLANG/s Data Types.

    After the expression is created, click OK.

To edit a filter for a send port

  1. In Visual Studio 2005, in a BizTalk Server project, on the View menu, click BizTalk Explorer.

  2. In BizTalk Explorer, expand the Send Ports collection, right-click the send port that contains the filter you want to edit, and then click Edit.

  3. In the Send Port Properties dialog box, expand the Filters & Mapping folder in the left pane, and then select the Filters node.

    The expression pane displays a list of the expressions that make up the filter associated with this send port or send port group. You can add or delete expressions, change the order of expressions, or select an expression to edit. To view the results of your changes, click Show Filter Expression on the toolbar.

  4. In the expression pane on the right, edit the list of filter expressions to build the filter you want, and then click OK.

    For information about writing expressions and combining them into a filter, seeXLANG/s Data Types.

See Also

Tasks

How to Edit Send Port Properties Using BizTalk Explorer
How to Add Maps to Send Ports for Outbound Normalization Using BizTalk Explorer
How to Add and Delete Send Ports from a Send Port Group Using BizTalk Explorer

Reference

SendPort Class
SendPort.Filter Property
MSBTS_SendPort.Filter Property (WMI)

Concepts

Using Filters With the Receive Message Shape
Content-Based Routing Using the BizTalk Explorer Object Model

Other Resources

Message Context Properties
About BizTalk Explorer Artifacts
Managing Send Ports Using BizTalk Explorer

Tags :


Page view tracker