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


Creating an input connector

Create an input connector by extending the AbstractInputConnector class.

Before you begin

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

About this task

Create an input connector when you want to listen for external events or receive data from external sources. Input connectors constitute the starting point of a message flow. Polling for input is a special case of an input connector that is supported in the connector framework.

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

This Java class diagram shows the AbstractConnectorFactory and AbstractInputConnector Java classes in the connector framework.

Procedure

To create an input connector, extend the AbstractInputConnector class.

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

The following example of an input connector JAVA file demonstrates how to create an input connector:
package connector.database;

import java.util.Properties;

import com.ibm.connectors.AbstractInputConnector;
import com.ibm.connectors.ConnectorException;

public class myInputConnector extends AbstractInputConnector {

	@Override
	protected void onInitialise() throws Exception {
		// TODO This method is called after the properties and container services have been
		// saved. 
		// You can call getLogger() to get a Java logger named with your connector's assigned name
		// You can call getProperty(<name>) to get a named property provided via the Toolkit 
		// You can create any resources you need here (and destroy them on terminate())
		// or you can wait until start() (destroying them on stop())
		getLogger().fine("Initialisation complete");
	}

	@Override
	public void start() throws ConnectorException {
		// TODO Implement the code here to start listening for input depending on the technology
		// being used.
		
		// You can call getCallback().processInboundData() to pass incoming input to the host application
		// Input data should be a byte array. Properties may also be returned. These will form part of the 
		// ongoing message to be processed by the message flow.
		byte[] data = null;
		Properties props = new Properties();
		getCallback().processInboundData(data, props);

	}

	@Override
	public boolean isStarted() {
		// TODO You need to track the state of the input connector since it varies depending on 
		// the technology being used.
		return false;
	}

	@Override
	public void stop() throws ConnectorException {
		// TODO Close down any input listeners here.

	}

	@Override
	public void terminate() throws ConnectorException {
		// TODO Release any resources here
	}
	
	

}

What to do next

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

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