org.jboss.soa.esb.listeners.gateway.mina
Class UdpGatewayListener

java.lang.Object
  extended by org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
      extended by org.jboss.soa.esb.listeners.gateway.mina.UdpGatewayListener
All Implemented Interfaces:
ManagedLifecycle

public class UdpGatewayListener
extends AbstractManagedLifecycle

UDP gateway listener implementation for receiving ESB unaware messages.

This gateway will set up a netty server and listen for incoming connection request. The requests will be passed to the Netty channel pipeline configured and the last handler will invoke the target ESB service. Example configuration:

<listeners>
    <udp-listener name="udp-listener" host="localhost" port="9999" handlerClass="org.jboss.soa.esb.listeners.gateway.mina.DefaultMessageHandler" is-gateway="true"/>
 </listeners>
 
  • host the host to listen to.
  • port the port to listen on.
  • handlerClass A class that implemtents MessageHandler. If not specified will default to DefaultMessageHandler.
  • is-gateway is always true as udp cannot be used as a bus transport at the moment.
  • Author:
    tom.fennelly@jboss.com, Daniel Bevenius

    Field Summary
     
    Fields inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
    PARAM_TERMINATION_PERIOD
     
    Constructor Summary
    UdpGatewayListener(ConfigTree config)
              Sole constructor.
     
    Method Summary
    protected  void doDestroy()
              Currently does nothing.
    protected  void doInitialise()
              Initialize will bind to the configured host and port.
    protected  void doStart()
              Currently does nothing.
    protected  void doStop()
              Unbinds the udp listener.
     java.lang.String toString()
              Returns a string representation in the form: [UdpGatewayListener] Started UdpGatewayListener [address=localhost/127.0.0.1:9999, targetService=UdpServiceCategory:Service1, messageHandler=org.jboss.soa.esb.listeners.gateway.mina.DefaultMessageHandler@3c205c]
     
    Methods inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
    addManagedLifecycleEventListener, changeState, destroy, getConfig, getState, getTerminationPeriod, initialise, removeManagedLifecycleEventListener, start, stop, waitUntilDestroyed, waitUntilDestroyed, waitUntilNotState, waitUntilState
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    UdpGatewayListener

    public UdpGatewayListener(ConfigTree config)
                       throws ConfigurationException
    Sole constructor.

    Parameters:
    config - The configuration associated with this instance. Must not be null.
    Throws:
    ConfigurationException - if a configuration errors during initialisation.
    Method Detail

    doInitialise

    protected void doInitialise()
                         throws ManagedLifecycleException
    Initialize will bind to the configured host and port. This is done in initialize so that the time this takes is done upon deployment of the gateway instead of during the first call to the gateway.

    Specified by:
    doInitialise in class AbstractManagedLifecycle
    Throws:
    ManagedLifecycleException - for errors while initialisation.

    doStart

    protected void doStart()
                    throws ManagedLifecycleException
    Currently does nothing.

    Specified by:
    doStart in class AbstractManagedLifecycle
    Throws:
    ManagedLifecycleException - for errors while starting.

    doStop

    protected void doStop()
                   throws ManagedLifecycleException
    Unbinds the udp listener.

    Specified by:
    doStop in class AbstractManagedLifecycle
    Throws:
    ManagedLifecycleException - for errors while stopping.

    doDestroy

    protected void doDestroy()
                      throws ManagedLifecycleException
    Currently does nothing.

    Specified by:
    doDestroy in class AbstractManagedLifecycle
    Throws:
    ManagedLifecycleException - for errors while destroying.

    toString

    public java.lang.String toString()
    Returns a string representation in the form: [UdpGatewayListener] Started UdpGatewayListener [address=localhost/127.0.0.1:9999, targetService=UdpServiceCategory:Service1, messageHandler=org.jboss.soa.esb.listeners.gateway.mina.DefaultMessageHandler@3c205c]

    Overrides:
    toString in class java.lang.Object
    Returns:
    String A string representation of this instance.