locked
Default message subscription in Content Based Routing solution RRS feed

  • Question

  • We have a BizTalk solution which uses content based routing to route messages to one of around 15 send ports based on a property of the message. Each Send Port has a filters which subscribes to one of more values of the property. e.g If the Property value is A, this will be routed to Send Port 1, if the property value is C or D it will be routed to send port 2, if the property value is X it is routed to Send port 3 (names and values are greatly simplified).

    Our problem comes is if we send a message to BizTalk for which we do not have a valid send port defined. e.g we send a message where the property is set to Z and there is no send port with a filter for a property value of Z. We could write a catch all send port but this becomes messy as we would have a compex filter saying something like not A and not C and Not D and not X . . . . . . . Likewise we could write  a validating pipeline but then this needs to know a valid list of propery values. What we would lilke to do, is that if at some point in the future Z becomes a valid value for the property, simply add a new port with a filter for Z or update one of the existing filters - no other changes needed. No need to update the validating port to say Z is now a valid value and no updating of a complex filter to add Z to the list of valid values.

    i.e. we want to have a 'catch-all' port which will process a message if it is not processed by any of the others ports and need to be able to add to the list of valid ports simply by defining a new port. So far the only way I have found of doing this is to write a service with subscribes to the error raised by BizTalk if no matching subscription is found - can't I just define a filter to subscribe to this instead?

    Thanks

    Nigel


    Nigel T

    Thursday, October 24, 2013 2:25 PM

Answers

  • Hi Nigel,

    For your requirement, you have to enable failed message routing in receive port.

    Using Failed Message Routing

    So when a message is received by a receive port, if no filter is found in send port/no subscription is found, you would get a error “published message could not be routed because no subscribers were found”. i.e. in your case, if a send port with filter for property -Z is not found, you would get "no subscribers were found" error for the received message. When failed message routing is enabled, then the failed message will be promoted with error report. BizTalk server promotes error-report to the context properties of the failed messages (demoting regular message context properties) when failed message routing is enabled.

    Then you can create a send port which filters for all messages with error report in the context. This send port would act as catch-all in your case. Filter in send port should be "ErrorReport.ErrorType == FailedMessage".


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.




    Thursday, October 24, 2013 2:35 PM

All replies

  • Hi Nigel,

    For your requirement, you have to enable failed message routing in receive port.

    Using Failed Message Routing

    So when a message is received by a receive port, if no filter is found in send port/no subscription is found, you would get a error “published message could not be routed because no subscribers were found”. i.e. in your case, if a send port with filter for property -Z is not found, you would get "no subscribers were found" error for the received message. When failed message routing is enabled, then the failed message will be promoted with error report. BizTalk server promotes error-report to the context properties of the failed messages (demoting regular message context properties) when failed message routing is enabled.

    Then you can create a send port which filters for all messages with error report in the context. This send port would act as catch-all in your case. Filter in send port should be "ErrorReport.ErrorType == FailedMessage".


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.




    Thursday, October 24, 2013 2:35 PM
  • Nigel,

    There are multiple way to handle it:

    - Create a SQL table to hold the value and possible destinations and a SP which should return a value if no destination is defined so for undefined destination the message could be sent to default port. In future new value can be added to this table.

    - Then you need to create a pipeline component (and possibly a caching mechanism to cache the value in SQL table) to check if destination exists if not then route it to default destination.

    -If rules are not complicated then SSO can also be used.

    -Other option is to create BRE policy.


    Please mark the post answered your question as answer, and mark other helpful posts as helpful, it'll help other users who are visiting your thread for the similar problem, Regards -Rohit Sharma (http://rohitt-sharma.blogspot.com/)

    Thursday, October 24, 2013 2:40 PM
    Moderator
  • I'd try and redesign the solution to use "BizTalk Parties" and "Orchestration Role-Links". So you'd have one orchestration which subscribes to the message. In the orchestration, you'd have a RoleLink where you'd be sending the messages. You'd define two messages for this orchestration say MsgReceived & Msg2BTransmitted. After receive you'd have a message construct where you'd assign the MsgReceived to the Msg2BTransmitted, copy the context properties and additionally set the destination party on the Msg2BTransmitted. If you put a Scope around this, then you'd be able to capture the Exception when the party is undefined, in which case you'd assign some "dummy" party. Finally when you send the message, BizTalk will take care of routing it to the correct send port (Send Port assigned to the Party). Tomorrow when a new party is defined (configuration where the Party is created and the send port is assigned to this party), the Party assignment will no longer generate an exception and the routing will get done.

    What has me worried is your mention of propery X = C or D and if because of filters, the message is delivered to more than ONE send port. if C & D are unique then there would not be any issues but if not, then you'd have a introduce a little complexity in terms of RULES to the solution. So you would create a configuration DB where you'll store these combinations, and use rules to evalute and assign a UNIQUE Party Code. The same rule would assign a default/dummy code (so no need to trap exceptions in the orchestration). So you;d call the rule with the value and get the UNIQUE Party Code in return which you;ll use to set the Destination Party on the Msg2BTransmitted.

    Regards.

    Thursday, October 24, 2013 2:46 PM