Example: Creating a new MQ header

This example shows you how to create a new MQ header for the ServiceMessageObject object inside a Custom Mediation primitive.

Context

The following code sample shows you how to create a new MQ header for the ServiceMessageObject object inside a Custom Mediation primitive. The Custom Mediation primitive is used to replace the MQ header inside an incoming ServiceMessageObject object.

Requirements

You must know how to set up a mediation flow with a Custom Mediation primitive.

Java imports

import com.ibm.websphere.sibx.smobo.MQHeaderType; 
import com.ibm.websphere.sibx.smobo.ServiceMessageObjectFactory; 

Code sample

. 
. 
. 
ServiceMessageObjectFactory smoFactory = ServiceMessageObjectFactory.eINSTANCE; 
MQHeaderType mqHeader = smoFactory.createMQHeaderType();
This code sample creates a new MQ header. An exception occurs if the code sample fails.