Customizing TIBCO AECM Message Generator

Generate a customized message generator to create a well-formed M-tree object of a certain wire format. To do this, extend the base class MsgGenerator and implement your own createMInstance method.

The parameter to createMInstance() is a RepEvent object. The following APIs defined in the base class allow you to retrieve specific information for your customization. Extend this base class to customize your message generator.

There are public methods to help you retrieve the data object information, Active Enterprise customized user properties, and the MClassRegistry.

These are the required methods for the customized message generator:

public class MsgGenerator implements WireFormatGenerator
{
    /** This method returns a well-formed MTree of a certain
    * WireFormat. You will need to extend this method
    * to customized your MsgGenerator.
    */
    public MTree createMInstance(Object repEvent) throws Exception
    
    /* Other APIs provided for retrieving information from
    * the RepEvent Object provided in the next section.
    */
...
}

The extending class must have a public constructor with no input argument. For example:

import com.sybase.connector.repra.tibrv.MsgGenerator;
import com.sybase.connector.repra.util.*;
public class MyMsgGenerator extends MsgGenerator
{
...
// This is the default constructor
public MyMsgGenerator()
{
}
...
}

To customize the message format, use the extending class implementation of the createMInstance() method. For example:

public MTree createMInstance(Object repmsg)
throws Exception
{
    MTree mTree = new MTree("msg");
    ...
    // do something to build the message MTree
    return mTree;
}