none
Filter at send port inside send port group is not working RRS feed

  • Question

  • Hello all,

    I have a simple schema containing Name, and gender field. Gender field is promoted using property schema.

    I have created a orchestration in which I am receiving a message and sending it out based on Gender.

    In admin Console I have created a receive port, receive location and two send ports having filters on it as follows,

     Send Port 1 filters : BiztalkSamples.PropertySchema.Gender == "Male" And
      BTS.ReceivePortName == GetMsg And

    Send Port 2 filters :   BiztalkSamples.PropertySchema.Gender == "Female" And 

                                    BTS.ReceivePortName                                == GetMsg  And

    I have added these send ports  in send port group and bind this group to a orchestration port.

    but when I strated the application n drop a file having gender "Male"

     it got send to all the send folders I am not understanding Filter is not or I am doing somthing wrong.

    I am trying to send files to respective folder based on Gender in incoming message.

    Please help..

    Thanks 



    • Edited by _NiLeSh Saturday, May 21, 2016 8:34 AM
    Saturday, May 21, 2016 8:32 AM

Answers

  • When adding ports in a sendport group, messages which match any of the ports' filters in the group will be sent to all ports in the group.
    More information can be found here.

    You can solve this by uncoupling your ports from your orchestration by using the Direct option on the logical port in your orchestration instead, and not use a sendport group.

    • Marked as answer by Angie Xu Monday, May 30, 2016 6:03 AM
    Saturday, May 21, 2016 8:45 AM
  • The message will be sent to all the send ports in the groups and the filters won't work as there is an OR relationship of the send port group filter with the individual send ports in the group. 

    Filters on send port groups do not override filters on individual send ports. Filters used on both send ports and a send port group operate in a cumulative nature. If the same filter is used on a send port group as well as the individual send ports within the group, it is likely that duplicate messages will be sent.

    The reason to have a Send port group is to group together send ports which have exactly the same filters and transfer exactly the same message to multiple locations.

    To solve this problem you can publish the message to the messagebox using direct port binding. The individual send ports with the filters will subscribe to this message type and the filters with the send ports.

    EDIT: Very Important, after you select direct port binding(messagebox) you send port should NOT have filter with BTS.ReceivePortName.

    In BizTalk subscription, you will have two subscriptions, one subscription- when you start the orchestration (which is directly bound to Receive port) and another subscription when you enlist the send port with filter for the Receive port. Here are the high level sequence to activities that would happen:

    1) So after the message is received by the Receive port, it would be published to BizTalk message box db.
    2) Subscription evaluation would take place to match subscription for the  published message (into BizTalk msgbox db).
    3) As in your case for the published message two subscriptions would be evaluated. And instance of orchestration  would receive the message and also the send port with filter which match to the Receive Port which published the message

    So your send port filters should be:

     
    Send Port 1 filters :BiztalkSamples.PropertySchema.Gender =="Male"   And
                                 BTS.MessageType              == ------- 
    Send Port 2 filters :BiztalkSamples.PropertySchema.Gender == "Female" And 
                                 BTS.MessageType              == -------



    Rachit Sikroria (Microsoft Azure MVP)

    Saturday, May 21, 2016 8:52 AM
    Moderator

All replies

  • When adding ports in a sendport group, messages which match any of the ports' filters in the group will be sent to all ports in the group.
    More information can be found here.

    You can solve this by uncoupling your ports from your orchestration by using the Direct option on the logical port in your orchestration instead, and not use a sendport group.

    • Marked as answer by Angie Xu Monday, May 30, 2016 6:03 AM
    Saturday, May 21, 2016 8:45 AM
  • The message will be sent to all the send ports in the groups and the filters won't work as there is an OR relationship of the send port group filter with the individual send ports in the group. 

    Filters on send port groups do not override filters on individual send ports. Filters used on both send ports and a send port group operate in a cumulative nature. If the same filter is used on a send port group as well as the individual send ports within the group, it is likely that duplicate messages will be sent.

    The reason to have a Send port group is to group together send ports which have exactly the same filters and transfer exactly the same message to multiple locations.

    To solve this problem you can publish the message to the messagebox using direct port binding. The individual send ports with the filters will subscribe to this message type and the filters with the send ports.

    EDIT: Very Important, after you select direct port binding(messagebox) you send port should NOT have filter with BTS.ReceivePortName.

    In BizTalk subscription, you will have two subscriptions, one subscription- when you start the orchestration (which is directly bound to Receive port) and another subscription when you enlist the send port with filter for the Receive port. Here are the high level sequence to activities that would happen:

    1) So after the message is received by the Receive port, it would be published to BizTalk message box db.
    2) Subscription evaluation would take place to match subscription for the  published message (into BizTalk msgbox db).
    3) As in your case for the published message two subscriptions would be evaluated. And instance of orchestration  would receive the message and also the send port with filter which match to the Receive Port which published the message

    So your send port filters should be:

     
    Send Port 1 filters :BiztalkSamples.PropertySchema.Gender =="Male"   And
                                 BTS.MessageType              == ------- 
    Send Port 2 filters :BiztalkSamples.PropertySchema.Gender == "Female" And 
                                 BTS.MessageType              == -------



    Rachit Sikroria (Microsoft Azure MVP)

    Saturday, May 21, 2016 8:52 AM
    Moderator