Broker 10.5 | webMethods Broker Documentation | webMethods Broker Messaging Programmer's Guide | JMS Marshalling | Inbound Marshalling | Inbound Marshalling Code Example
Inbound Marshalling Code Example
A simple inbound marshaller is shown below. The marshaller converts all events into a TextMessage with the text field set to a string containing a line for each field with the name, an equals sign, and the value.
class SimpleMarshalIn implements WmMarshalIn
public WmMessage mapMessageFromEvent(Object eventIn, Object userData,
WmMessageFactory msgFactory) throws Exception
BrokerEvent event = (BrokerEvent) eventIn;
TextMessage msg = msgFactory.createTextMessage();
String[] fieldNames = event.getFieldNames(null);
StringBuffer buf = new StringBuffer();
for (int i = 0; i < fieldNames.length; i++) {
BrokerField field = event.getField(fieldNames[i]);
return (WmMessage) msg;