Search in sources :

Example 11 with ConnectionControl

use of org.apache.activemq.command.ConnectionControl in project activemq-artemis by apache.

the class ConnectionControlTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConnectionControl info = (ConnectionControl) object;
    info.setClose(true);
    info.setExit(false);
    info.setFaultTolerant(true);
    info.setResume(false);
    info.setSuspend(true);
}
Also used : ConnectionControl(org.apache.activemq.command.ConnectionControl)

Example 12 with ConnectionControl

use of org.apache.activemq.command.ConnectionControl in project activemq-artemis by apache.

the class QueueOptimizedDispatchExceptionTest method TestOptimizedDispatchCME.

@Test
public void TestOptimizedDispatchCME() throws Exception {
    final PersistenceAdapter persistenceAdapter = broker.getPersistenceAdapter();
    final MessageStore queueMessageStore = persistenceAdapter.createQueueMessageStore(destination);
    final ConnectionContext contextNotInTx = new ConnectionContext();
    contextNotInTx.setConnection(new Connection() {

        @Override
        public void stop() throws Exception {
        }

        @Override
        public void start() throws Exception {
        }

        @Override
        public void updateClient(ConnectionControl control) {
        }

        @Override
        public void serviceExceptionAsync(IOException e) {
        }

        @Override
        public void serviceException(Throwable error) {
        }

        @Override
        public Response service(Command command) {
            return null;
        }

        @Override
        public boolean isSlow() {
            return false;
        }

        @Override
        public boolean isNetworkConnection() {
            return false;
        }

        @Override
        public boolean isManageable() {
            return false;
        }

        @Override
        public boolean isFaultTolerantConnection() {
            return false;
        }

        @Override
        public boolean isConnected() {
            return true;
        }

        @Override
        public boolean isBlocked() {
            return false;
        }

        @Override
        public boolean isActive() {
            return false;
        }

        @Override
        public ConnectionStatistics getStatistics() {
            return null;
        }

        @Override
        public String getRemoteAddress() {
            return null;
        }

        @Override
        public int getDispatchQueueSize() {
            return 0;
        }

        @Override
        public Connector getConnector() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getConnectionId() {
            return null;
        }

        @Override
        public void dispatchSync(Command message) {
        }

        @Override
        public void dispatchAsync(Command command) {
        }

        @Override
        public int getActiveTransactionCount() {
            return 0;
        }

        @Override
        public Long getOldestActiveTransactionDuration() {
            return null;
        }
    });
    final DestinationStatistics destinationStatistics = new DestinationStatistics();
    final Queue queue = new Queue(broker, destination, queueMessageStore, destinationStatistics, broker.getTaskRunnerFactory());
    final MockMemoryUsage usage = new MockMemoryUsage();
    queue.setOptimizedDispatch(true);
    queue.initialize();
    queue.start();
    queue.memoryUsage = usage;
    ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
    ProducerInfo producerInfo = new ProducerInfo();
    ProducerState producerState = new ProducerState(producerInfo);
    producerExchange.setProducerState(producerState);
    producerExchange.setConnectionContext(contextNotInTx);
    // populate the queue store, exceed memory limit so that cache is disabled
    for (int i = 0; i < count; i++) {
        Message message = getMessage(i);
        queue.send(producerExchange, message);
    }
    usage.setFull(false);
    try {
        queue.wakeup();
    } catch (Exception e) {
        LOG.error("Queue threw an unexpected exception: " + e.toString());
        fail("Should not throw an exception.");
    }
}
Also used : MessageStore(org.apache.activemq.store.MessageStore) Connector(org.apache.activemq.broker.Connector) ProducerBrokerExchange(org.apache.activemq.broker.ProducerBrokerExchange) ProducerInfo(org.apache.activemq.command.ProducerInfo) ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) Message(org.apache.activemq.command.Message) Connection(org.apache.activemq.broker.Connection) IOException(java.io.IOException) IOException(java.io.IOException) Response(org.apache.activemq.command.Response) ConnectionControl(org.apache.activemq.command.ConnectionControl) Command(org.apache.activemq.command.Command) ProducerState(org.apache.activemq.state.ProducerState) ConnectionContext(org.apache.activemq.broker.ConnectionContext) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) PersistenceAdapter(org.apache.activemq.store.PersistenceAdapter) Test(org.junit.Test)

Example 13 with ConnectionControl

use of org.apache.activemq.command.ConnectionControl in project activemq-artemis by apache.

the class OpenWireProtocolManager method newConnectionControl.

protected ConnectionControl newConnectionControl() {
    ConnectionControl control = new ConnectionControl();
    String uri = generateMembersURI(rebalanceClusterClients);
    control.setConnectedBrokers(uri);
    control.setRebalanceConnection(rebalanceClusterClients);
    return control;
}
Also used : ConnectionControl(org.apache.activemq.command.ConnectionControl) SimpleString(org.apache.activemq.artemis.api.core.SimpleString)

Example 14 with ConnectionControl

use of org.apache.activemq.command.ConnectionControl in project activemq-artemis by apache.

the class ConnectionControlTest method createObject.

@Override
public Object createObject() throws Exception {
    ConnectionControl info = new ConnectionControl();
    populateObject(info);
    return info;
}
Also used : ConnectionControl(org.apache.activemq.command.ConnectionControl)

Example 15 with ConnectionControl

use of org.apache.activemq.command.ConnectionControl in project activemq-artemis by apache.

the class ConnectionControlTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConnectionControl info = (ConnectionControl) object;
    info.setClose(true);
    info.setExit(false);
    info.setFaultTolerant(true);
    info.setResume(false);
    info.setSuspend(true);
    info.setConnectedBrokers("ConnectedBrokers:1");
    info.setReconnectTo("ReconnectTo:2");
    info.setRebalanceConnection(false);
}
Also used : ConnectionControl(org.apache.activemq.command.ConnectionControl)

Aggregations

ConnectionControl (org.apache.activemq.command.ConnectionControl)21 IOException (java.io.IOException)2 InvalidClientIDException (javax.jms.InvalidClientIDException)1 ActiveMQSecurityException (org.apache.activemq.artemis.api.core.ActiveMQSecurityException)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 Connection (org.apache.activemq.broker.Connection)1 ConnectionContext (org.apache.activemq.broker.ConnectionContext)1 Connector (org.apache.activemq.broker.Connector)1 ProducerBrokerExchange (org.apache.activemq.broker.ProducerBrokerExchange)1 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)1 ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)1 Command (org.apache.activemq.command.Command)1 Message (org.apache.activemq.command.Message)1 ProducerInfo (org.apache.activemq.command.ProducerInfo)1 Response (org.apache.activemq.command.Response)1 ProducerState (org.apache.activemq.state.ProducerState)1 MessageStore (org.apache.activemq.store.MessageStore)1 PersistenceAdapter (org.apache.activemq.store.PersistenceAdapter)1 Test (org.junit.Test)1