WebSphere Message Broker, Version 8.0.0.7
Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS
See information about the latest product version
See information about the latest product version
Accessing user-defined properties from a .NETCompute node
You can customize a .NETCompute node to access properties that you have associated with the message flow in which the node is included.
To access these properties from a .NETCompute node, use the GetUserDefinedProperty
or GetUserDefinedPropertyAsString methods. The following sample C#
code below shows how the methods can be used:
#region UserCode
// Add user code in this region to create a new output message
int intProperty = (int)this.GetUserDefinedProperty("intProperty");
string stringProperty = this.GetUserDefinedPropertyAsString("stringProperty");
NBElement msg = outputRoot.CreateLastChildUsingNewParser(NBParsers.XMLNSC.ParserName).CreateFirstChild(null, "Message");
NBElement el2 = msg.CreateFirstChild("Element2");
NBElement el1 = msg.CreateFirstChild("Element1");
el1.SetValue("The message flow user defined property named intProperty has the value "+intProperty.ToString());
el2.SetValue("The message flow user defined property named stringProperty has the value "+stringProperty);
#endregion UserCode
This code produces
the following message (where the integer and string flow properties
are set to the values 23 and "Hello World!" respectively):
<Message>
<Element1>The message flow user defined property named intProperty has the value 23</Element1>
<Element2>The message flow user defined property named stringProperty has the value Hello World!</Element2>
</Message>