com.ibm.broker.connector

Class PollingInputConnector



  • public abstract class PollingInputConnector
    extends InputConnector
    PollingInputConnector is the base class which must be extended to implement a connector which can poll for data from the system.

    It is used by IBM Integration Bus to obtain data from a system. It is created by the ConnectorFactory object which must also be implemented by a connector writer.

    The PollingInputConnector is constructed when a node requiring it's function is constructed (for example: a ComIbmPollingInputNode). The following methods are called by IBM Integration Bus to interact with the connector:

    • initialize is called when a node using the connector is constructed.
    • start is called when a node using the connector is ready to receive data.
    • stop is called when a node using the connector is no longer ready to receive data.
    • Terminate is called when the node is stopped or destroyed.

    The connector writer constructs PollingResult objects which are returned to Integration Bus from the ReadData method.

    • Constructor Detail

      • PollingInputConnector

        public PollingInputConnector(ConnectorFactory connectorFactory,
                                     java.lang.String name,
                                     java.util.Properties properties)
                              throws com.ibm.broker.plugin.MbException
        Constructor that must be used to create PollingInputConnector objects.
        Parameters:
        name - the name given to the connector based on the flow and node name
        properties - the node properties used to construct this connector
        connectorFactory - the connection factory constructing this connector
        Throws:
        com.ibm.broker.plugin.MbException
    • Method Detail

      • logNoData

        public void logNoData()
                       throws com.ibm.broker.plugin.MbException
        If it is not overridden then a standard activity log message is written stating it is waiting for data. Throwing an exception will cause no activity log message to be written out.
        Throws:
        com.ibm.broker.plugin.MbException
      • readData

        public abstract PollingResult readData(long timeout)
                                        throws com.ibm.broker.plugin.MbException
        Called by the Integration Bus to obtain data to be processed. The method returns when it has data or when the timeout interval has elapsed. It can return early if it wishes, and returning early is preferred over returning late. If the source you are retrieving data from supports a timed poll mechanism, then make sure it waits for no longer than the given timeout value. However, if the source does not support direct polling, it it better to make a single attempt to get data and then return early rather than code a loop to make repeated attempts at obtaining data. It is also good practice not to call sleep during this method. Return a TimeoutPollingResult instead.
        Parameters:
        timeout - The maximum time the method should wait for data before returning.
        Returns:
        A PollingResult representing data for processing or a timeout.
        Throws:
        com.ibm.broker.plugin.MbException
IBM Integration BusTM
JavaTM Connector API