Creating a New Custom BusinessEvents Channel

You can use the custom channel API to create a custom channel according to your requirement for your project.

The Java API for custom channel (com.tibco.be.custom.channel package) is bundled with TIBCO BusinessEvents. For more information about the classes in the com.tibco.be.custom.channel package see Java API Reference.

Procedure

  1. Create a XML file and save it with the name drivers.xml.
  2. In the XML file, define the drivers for the channel in the following format.
    <?xml version="1.0" encoding="UTF-8"?>
    <drivers>
        <driver>
            <type>CHANNEL_TYPE</type>
            <label>CHANNEL_LABEL</label>
            <class>DRIVER_CLASS </class>
            <description>CHANNEL_DESCRIPTION</description>
            <version>CHANNEL_VERSION</version>
            <properties>
                <!--Channel Properties -->
            </properties>
            <destinations>
                <!--Destination Properties -->
            </destinations>
            <serializers userdefined="true">
                <serializer type="SERIALIZER_TYPE" class="SERIALIZER_CLASS"/>
                <!--Additional Serializers -->
            </serializers>
        </driver>
    </drivers>
    
    
    Where,
    • CHANNEL_TYPE - The channel type that you have defined. This is displayed in the BusinessEvents Studio under the Driver Type field in the New Channel Wizard.
    • CHANNEL_LABEL - Display name of the channel.
    • DRIVER_CLASS - The URI of the BaseDriver class that you have implemented.
    • CHANNEL_DESCRIPTION - Short description of the channel.
    • CHANNEL_VERSION - Version number of the channel.
    • <!--Channel Properties --> - Define the configuration properties for the channel. Specify the name, type, and default value of the properties. These properties are displayed as channel properties in BusinessEvents Studio.
    • <!--Destination Properties --> - Define the configuration poperties for the destination of the custom channel. Specify the name, type, and default value of the properties. These properties are displayed as destination properties in BusinessEvents Studio.
    • SERIALIZER_TYPE - Type of the serializer for the channel. You can define multiple serializers.
    • SERIALIZER_CLASS - Class of the serializer that you have defined. Specify at least one serializer for the channel. The class is listed in the BusinessEvents Studio under the Serializer/Deserializer field while adding destination for the custom channel.
  3. Create all the required Java class files using the Java API for custom channel. Archive all the Java class files for the custom channel with the drivers.xml file as a JAR file.
    Refer to the Kafka channel example and its source code for the custom channel Java API usage. The Kafka channel example is located at BE_HOME\examples\standard\KafkaChannel and the source code is located atBE_HOME\api\channel-api\examples\kafka\src. See Key Java API Components for Custom Channel for key components of the custom channel API.

    Refer to the Java API Reference for complete details on Java API for custom channel (com.tibco.be.custom.channel package).

  4. Copy this JAR file at BE_HOME\lib\ext\tpcl and restart BusinessEvent Studio.
    New custom channel is displayed under the Driver Type in the New Channel Wizard.

Sample Kafka Channel Drivers.xml File

The following sample code is of the drivers.xml file for the Kafka channel example:
<?xml version="1.0" encoding="UTF-8"?>
<drivers>
	<driver>
        <type>Kafka</type>
        <label>Kafka</label>
        <class>com.tibco.be.custom.channel.kafka.KafkaDriver</class>
        <description>Apache Kafka is an open-source message broker project developed by the Apache Software Foundation written in Scala. The project aims to provide a unified, high-throughput, low-latency platform for handling real-time data feeds.</description>
        <version>1.0.0.0</version>
         <properties>
            <property name="BootstrapServers" type="String" default="localhost:9095"/>
        </properties>
        <destinations>
        	<property name="GroupID" type="String" default="kafka_group"/>
            <property name="ClientID" type="String" default="1"/>
            <property name="Topic" type="String" default="ktopic"/>
            <property name="Threads" type="Integer" default="1"/>
            <property name="PollInterval" type="Integer" default="100"/>
        </destinations>
        <serializers userdefined="true">
            <serializer type="Map" class="com.tibco.be.custom.channel.kafka.serializer.KafkaEventSerializer"/>
        </serializers>
    </driver>
</drivers>

Sample Kafka Channel BusinessEvents Studio UI

The following screen shows the fields of the Kafka channel in BusinessEvents Studio, according to the drivers.xml file.
Kafka Channel BusinessEvents Studio UI