IBM Integration Bus, Version 10.0.0.3 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS


Creating an output connector

Create an output connector by extending the AbstractOutputConnector and AbstractOutputInteraction classes.

Before you begin

Create a connector provider by following the instructions in Creating a connector factory.

About this task

Create an output connector when you want to send data or publish events to external systems without receiving a response.

The following example shows the Java™ classes that you need to create for an output connector:

This Java class diagram shows the AbstractConnectorFactory, AbstractOutputConnector, and AbstractOutputInteraction classes in the connector framework.

Procedure

  1. To create an output connector, extend the AbstractOutputConnector class.

    Javadoc documentation for the Connector Framework API is available at Connector API.

    The following example of an output connector Java file demonstrates how to create an output connector.
    package connector.database;
    
    import com.ibm.connectors.AbstractOutputConnector;
    import com.ibm.connectors.ConnectorException;
    import com.ibm.connectors.OutputInteraction;
    
    public class myOutputConnector extends AbstractOutputConnector {
    
    	@Override
    	public OutputInteraction createOutputInteraction() throws ConnectorException {
    		// TODO Create the output interaction here. The interaction is the object
    		// that represents the actual output (even if it doesn't actually perform it).
    		// The interaction will receive any dynamic properties configured by the message 
    		// flow, as well as the actual data to be sent
    		return null;
    	}
    
    
    }
    The connector framework calls the createOutputInteraction method when a message is to be processed.
  2. Configure the output interaction by extending the AbstractOutputInteraction class.
    The following example of an output interaction Java file demonstrates how to create the output interaction:
    package connector.database;
    
    import java.util.Properties;
    
    import com.ibm.connectors.AbstractOutputInteraction;
    import com.ibm.connectors.ConnectorCallback;
    import com.ibm.connectors.ConnectorException;
    
    // The output interaction class publishes data to a remote system.
    // Currently, the data to send is received as a byte array, and it
    // should return a properties object in return that describes the outcome. 
    // Dynamic properties may be passed in to configure the output per-message.
    public class myOutputInteraction extends AbstractOutputInteraction {
    
    	@Override
    	public Properties send(Properties overrideProperties, Object data)
    			throws ConnectorException {
    		byte[] byteData = (byte[]) data;
    		// TODO Implement code here to send the byte data to the external
    		// system. Return any details (eg success, no of bytes sent) in
    		// a properties object which will be available to downstream nodes
    		// within the message flow 
    		return null;
    	}
    
    	@Override
    	public long asyncSend(Properties overrideProperties, Object data,
    			ConnectorCallback callback) throws ConnectorException {
    		// TODO Send asynchronously and return a 'ticket'. Currently
    		// unsupported/unused.
    		return 0;
    	}
    
    }

What to do next

After you create the connector factory and connector, create the connector.xml descriptor file (see Creating a connector descriptor file).

cb23135_.htm | Last updated 2015-11-27 00:02:17