Search in sources :

Example 1 with AMQPConnectionContext

use of org.apache.activemq.artemis.protocol.amqp.proton.AMQPConnectionContext in project activemq-artemis by apache.

the class ProtonProtocolManager method createConnectionEntry.

@Override
public ConnectionEntry createConnectionEntry(Acceptor acceptorUsed, Connection remotingConnection) {
    AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(this, remotingConnection, server.getExecutorFactory().getExecutor(), server);
    long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL;
    if (server.getConfiguration().getConnectionTTLOverride() != -1) {
        ttl = server.getConfiguration().getConnectionTTLOverride();
    }
    String id = server.getConfiguration().getName();
    boolean useCoreSubscriptionNaming = server.getConfiguration().isAmqpUseCoreSubscriptionNaming();
    AMQPConnectionContext amqpConnection = new AMQPConnectionContext(this, connectionCallback, id, (int) ttl, getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), true, null, null);
    Executor executor = server.getExecutorFactory().getExecutor();
    ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(this, amqpConnection, remotingConnection, executor);
    delegate.addFailureListener(connectionCallback);
    delegate.addCloseListener(connectionCallback);
    connectionCallback.setProtonConnectionDelegate(delegate);
    ConnectionEntry entry = new ConnectionEntry(delegate, executor, System.currentTimeMillis(), ttl);
    return entry;
}
Also used : Executor(java.util.concurrent.Executor) ConnectionEntry(org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry) AMQPConnectionContext(org.apache.activemq.artemis.protocol.amqp.proton.AMQPConnectionContext) SimpleString(org.apache.activemq.artemis.api.core.SimpleString)

Example 2 with AMQPConnectionContext

use of org.apache.activemq.artemis.protocol.amqp.proton.AMQPConnectionContext in project activemq-artemis by apache.

the class AMQPClientConnectionFactory method createConnection.

public ActiveMQProtonRemotingConnection createConnection(ProtonProtocolManager protocolManager, Connection connection, Optional<EventHandler> eventHandler, ClientSASLFactory clientSASLFactory) {
    AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(protocolManager, connection, server.getExecutorFactory().getExecutor(), server);
    Executor executor = server.getExecutorFactory().getExecutor();
    AMQPConnectionContext amqpConnection = new AMQPConnectionContext(protocolManager, connectionCallback, containerId, ttl, protocolManager.getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), false, clientSASLFactory, connectionProperties);
    eventHandler.ifPresent(amqpConnection::addEventHandler);
    ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(protocolManager, amqpConnection, connection, executor);
    delegate.addFailureListener(connectionCallback);
    delegate.addCloseListener(connectionCallback);
    connectionCallback.setProtonConnectionDelegate(delegate);
    return delegate;
}
Also used : Executor(java.util.concurrent.Executor) AMQPConnectionContext(org.apache.activemq.artemis.protocol.amqp.proton.AMQPConnectionContext) AMQPConnectionCallback(org.apache.activemq.artemis.protocol.amqp.broker.AMQPConnectionCallback) ActiveMQProtonRemotingConnection(org.apache.activemq.artemis.protocol.amqp.broker.ActiveMQProtonRemotingConnection)

Aggregations

Executor (java.util.concurrent.Executor)2 AMQPConnectionContext (org.apache.activemq.artemis.protocol.amqp.proton.AMQPConnectionContext)2 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 AMQPConnectionCallback (org.apache.activemq.artemis.protocol.amqp.broker.AMQPConnectionCallback)1 ActiveMQProtonRemotingConnection (org.apache.activemq.artemis.protocol.amqp.broker.ActiveMQProtonRemotingConnection)1 ConnectionEntry (org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry)1