Search in sources :

Example 1 with AMQPInputHandler

use of com.swiftmq.net.protocol.amqp.AMQPInputHandler in project swiftmq-ce by iitsoftware.

the class AMQPSwiftlet method createListener.

private void createListener(Entity listenerEntity) throws SwiftletException {
    Entity connectionTemplate = getConnectionTemplate((String) listenerEntity.getProperty("connection-template").getValue());
    String listenerName = listenerEntity.getName();
    int port = ((Integer) listenerEntity.getProperty("port").getValue()).intValue();
    InetAddress bindAddress = null;
    try {
        String s = (String) listenerEntity.getProperty("bindaddress").getValue();
        if (s != null && s.trim().length() > 0)
            bindAddress = InetAddress.getByName(s);
    } catch (Exception e) {
        throw new SwiftletException(e.getMessage());
    }
    int inputBufferSize = ((Integer) connectionTemplate.getProperty("router-input-buffer-size").getValue()).intValue();
    int inputExtendSize = ((Integer) connectionTemplate.getProperty("router-input-extend-size").getValue()).intValue();
    int outputBufferSize = ((Integer) connectionTemplate.getProperty("router-output-buffer-size").getValue()).intValue();
    int outputExtendSize = ((Integer) connectionTemplate.getProperty("router-output-extend-size").getValue()).intValue();
    boolean useTCPNoDelay = ((Boolean) connectionTemplate.getProperty("use-tcp-no-delay").getValue()).booleanValue();
    AMQPInputHandler protHandler = new AMQPInputHandler();
    ListenerMetaData meta = new ListenerMetaData(bindAddress, port, this, -1, (String) connectionTemplate.getProperty("socketfactory-class").getValue(), new Acceptor(listenerName, listenerEntity.getProperty("max-connections"), listenerEntity.getProperty("sasl-enabled"), listenerEntity.getProperty("connection-template")), inputBufferSize, inputExtendSize, outputBufferSize, outputExtendSize, useTCPNoDelay, protHandler, new RawOutputHandler());
    listenerEntity.setUserObject(meta);
    createHostAccessList(meta, (EntityList) listenerEntity.getEntity("host-access-list"));
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(getName(), "starting listener '" + listenerName + "' ...");
    try {
        ctx.networkSwiftlet.createTCPListener(meta);
    } catch (Exception e) {
        throw new SwiftletException(e.getMessage());
    }
}
Also used : AMQPInputHandler(com.swiftmq.net.protocol.amqp.AMQPInputHandler) RawOutputHandler(com.swiftmq.net.protocol.raw.RawOutputHandler) SwiftletException(com.swiftmq.swiftlet.SwiftletException) ConnectionVetoException(com.swiftmq.swiftlet.net.ConnectionVetoException) SwiftletException(com.swiftmq.swiftlet.SwiftletException) ListenerMetaData(com.swiftmq.swiftlet.net.ListenerMetaData) InetAddress(java.net.InetAddress)

Aggregations

AMQPInputHandler (com.swiftmq.net.protocol.amqp.AMQPInputHandler)1 RawOutputHandler (com.swiftmq.net.protocol.raw.RawOutputHandler)1 SwiftletException (com.swiftmq.swiftlet.SwiftletException)1 ConnectionVetoException (com.swiftmq.swiftlet.net.ConnectionVetoException)1 ListenerMetaData (com.swiftmq.swiftlet.net.ListenerMetaData)1 InetAddress (java.net.InetAddress)1