Basically, I want to do content based routing. I would like to publish messages to a single topic. I would like a pipeline event handler on that topic publisher to inspect the messages published then route it to another topic as appropriate. I think it could be as simple as a pipeline with a SetProperty step that moves the value of a Custom Property into the Topic property, but I’m not sure if that will do the trick. I'm using datagram and an MSMQ transport. Also, I'm not exactly sure which topic, pub and sub queues need to exist if I implement a pipeline router. Could you please provide some guidance, documentation and/or examples?
You can use either an existing Condition or an ad hoc condition in the subscriptions to create content based routing. This is accessible through the Subscription builder dialog box that you launch from the Publisher/Subscriber UI in the Neuron ESB Explorer. Either you can do Xpath against the body…or you can type in a custom property in the conditions form.
For example. If the source message XML is and you wanted to inspect the Body of the message for routing:
<book isbn="0836217462">
<title>Being a Dog Is a Full-Time Job</title>
<author>Charles M. Schulz</author>
<character>
<name>Snoopy</name>
<friend-of>Peppermint Patty</friend-of>
<since>1950-10-04</since>
<qualification>extroverted beagle</qualification>
</character>
<character>
<name>Peppermint Patty</name>
<since>1966-08-22</since>
<qualification>bold, brash and tomboyish</qualification>
</character>
</book>
A content-based condition would be similar to:
Field Predicate Value
Body Matches XPath /book/character/name[contains(text(), "Snoopy")]
The above XML would pass the condition.
Alternatively, if you wanted to route the message based on a custom property that you previously set in a process:
A custom property based condition would be similar to:
Field Predicate Value
Prefix.PropertyName Any Predicate Any Value
For custom properties you just have to manually type in the prefix and name of the property in the drop down field
Do I just set context.Data.Header.Topic = to the value I get from Prefix.PropertyName? Is that sufficient to get the message routed to a different topic?
Okay, here's where I'm at. I'm using a client connector to get messages onto the bus. I'm adding two custom soap headers to the service call. One header contains the topic name, and the other header contains the subtopic name. It looks like these headers are added to the custom properties collection inside the ESB message. What is the best way to set the topic to the topic and subtopic values contained in the headers/custom properties? This is starting to get urgent.
Neuron ESB Product Support Forums and Communities
© 2024 Created by Neuron Admin. Powered by