Use the Message Broker Java™ API when developing message flow
applications to create or change user-defined properties (UDPs).
You can create new UDPs and add them to the message flow,
or you can discover existing UDPs and modify them.
- The following example shows you how to create a UDP and
add it to a message flow:
- A UDP called Property1 is
created in parameter group Group1.
The data type of the UDP is defined as a string and the UDP is given
the default value Hello World!
- The UDP is then added to the message flow by using the addFlowProperty() method.
File msgFlow = new File("main.msgflow");
MessageFlow mf1 = FlowRendererMSGFLOW.read(msgFlow);
UserDefinedProperty udp = new UserDefinedProperty("Group1", "Property1", UserDefinedProperty.Usage.MANDATORY, UserDefinedProperty.Type.STRING, "Hello World!");
mf1.addFlowProperty(udp);
- In the following example, the existing UDPs in a message
flow are discovered by using the getFlowProperties() method
on the message flow. The setName() method is then
used to set the name of the first UDP to Property3:
File msgFlow = new File("main.msgflow");
MessageFlow mf1 = FlowRendererMSGFLOW.read(msgFlow);
Vector<FlowProperty> flowProperties = mf1.getFlowProperties();
flowProperties.get(0).setName("Property3");