Broker 10.5 | webMethods Broker Documentation | webMethods Broker Messaging Programmer's Guide | JMS Marshalling | Outbound Marshalling
 
Outbound Marshalling
 
Program Control Flow for Outbound Marshalling
Outbound Marshalling Code Example
The outbound marshalling object sets the destination and method of delivery for the Broker event, using the WmBrokerEventWrapper class.
public interface WmMarshalOut
{
public WmBrokerEventWrapper mapMessageToEvent(Message msg,
Object userData);
}
 
public abstract class WmBrokerEventWrapper
{
public static WmBrokerEventWrapper create(Object brokerEvent)
throws Exception
{
return new WmBrokerEventWrapperImpl(brokerEvent);
}

public abstract void setDestinationId(String destId);
public abstract String getDestinationId();
}
If the marshalling object sets the DestinationId in the WmBrokerEventWrapper that is returned, the webMethods Broker used as a JMS provider delivers the event to that Broker client (the DestinationId must be a valid Broker clientID). If the DestinationId is not set, the event is published using the event type specified in the BrokerEvent. If the event type has not been set for either method of delivery, a JMSException will be thrown from the publish or send operation.
The marshalling object can determine the destination of the message from the JMSDestination header field in the message. This should be cast to the webMethods-specific destination as follows:
WmDestination destination =(WmDestination) msg.getJMSDestination();
The getEventType() method can be used to find out what the webMethods Broker used as a provider would have used for the Broker event type. For queues, the getName() method will tell the Broker the client name to which the event would be delivered.
The marshalling object can indicate that it wants to use standard processing by returning a value of null. The webMethods Broker used as a JMS provider then publishes or delivers the message as if marshalling was not specified.