Hi
In my publisher i want to set the Topic of the message based on the root note in an XML document.
I have tryied with this code, context.Data.Header.Topic ="Test", but does not work.
The topic "Test", is created under topics.
Is this propertie read-only?
Can it be changed from a process?
Tags:
Christian - are you using a publish step from within a process? If you are, the publish step ignores the property context.Data.Header.Topic. You set the topic that the publish step uses in one of two ways. Select the publish step and you'll see the properties for it in the lower-right corner of ESB Explorer. If the "Selector Type" property is set to "Constant", then expand the "Topic Selector" property and select the Topic from the drop-down list. If the "Selector Type" property is sent to Code, then click on the ellipsis next to the Code property to open a code editor. You need to return a string that is the topic to publish to. In your case, you can either use:
return "Test";
Or, if you have already set the topic in a Code step:
return message.Header.Topic;
If you are not using a publish step in the process, then something else is happening. Can you check the Neuron ESB v3 event log and see if there are any errors or warnings?
Thank you,
Joe
No - Neuron doesn't execute C# code in any property value fields. The only places C# code is executed are properties that open code editors.
There are a couple of different things to point out here:
1. All publish mode adapter endpoints need to have a valid "Publish Topic" value set. This is the topic the message will be published to the bus, unless #2 below applies.
2. The topic of a message can be changed inside a Process. There are two ways to do this. The first way is in a code step (i.e. C# Step), where you set context.Data.Header.Topic = "yourNewTopic". This will override whatever value you put into the Publish Topic property in the adapter endpoint. The second way is to use a Publish Step (different than what you show above).
I attached a Neuron configuration that changes the topic in a process using a code step. One thing to note is that if you have a process, the publisher needs to be configured to execute the process.
Neuron ESB Product Support Forums and Communities
© 2024 Created by Neuron Admin. Powered by