Key Java API Components for Custom Channel

Using the Java API, you can create your own custom channel according to your requirement.

Refer to the Java API Reference for complete list of Java classes and interfaces for the custom channel. However, few of the key Java classes, interfaces and their key components are mentioned in the following section. You can implement these methods to create your custom channel.

class com.tibco.be.custom.channel.BaseDriver

The following methods of the BaseDriver class are called by BusinessEvents runtime, during startup for initialization of channel and destination.
  • getChannel
  • getDestination

class com.tibco.be.custom.channel.BaseChannel

The following methods of the BaseChannel class are called by BusinessEvents runtime during startup, for initalizing, starting, connecting and closing of channels.
  • init
  • start
  • connect
  • close

class com.tibco.be.custom.channel.BaseDestination

The following methods of the BaseDestination class are called by BusinessEvents runtime for initializing, starting, connecting, and closing destinations.
  • init
  • start
  • connect
  • close
The following send and requestEvent methods corresponds to the Event.sendEvent and Event.requestEvent catalog functions, respectively.
  • send
  • requestEvent

interface com.tibco.be.custom.channel.Event

You need to implement the Event interface which holds the underlying event related data. An instance of this interface is to be returned through the custom deserializer.
Note: A default implementation of the event interface is provided in the class: com.tibco.be.custom.channel.DefaultEventImpl. You can reuse or extend this class or provide your own implementation.

class com.tibco.be.custom.channel.BaseEventSerializer

You need to extend the BaseEventSerializer class. The following methods are used during serialization and deserialization of the custom channel message.
  • initUserEventSerializer - initializes the serializer
  • serializeUserEvent
  • deserializeUserEvent

You must specify the fully qualified Java class name of the serializer in the drivers.xml file.

interface com.tibco.be.custom.channel.EventContext

A new instance of this interface is to be returned through the BaseDriver.getDestination().getEventContext method. Implement the following EventContext interface methods.
  • reply - This corresponds to the catalog function Event.replyEvent.
  • acknowledge - For some messaging systems, this method specifies an indication that this message can be removed from the messaging system. This method is called by BusinessEvents when message processing is completed.
  • rollback - For messaging systems that support transactions, rollback is invoked by BusinessEvents when there is an internal failure during the transaction. The implementation handles rollback as applicable to the custom channel.