Search in sources :

Example 21 with ConnectionId

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

the class ConnectionIdTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConnectionId info = (ConnectionId) object;
    info.setValue("Value:1");
}
Also used : ConnectionId(org.apache.activemq.command.ConnectionId)

Example 22 with ConnectionId

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

the class MessageGroupMapTest method createConsumerId.

protected ConsumerId createConsumerId() {
    ConnectionId connectionId = new ConnectionId("" + ++idCounter);
    SessionId sessionId = new SessionId(connectionId, ++idCounter);
    ConsumerId answer = new ConsumerId(sessionId, ++idCounter);
    return answer;
}
Also used : ConnectionId(org.apache.activemq.command.ConnectionId) ConsumerId(org.apache.activemq.command.ConsumerId) SessionId(org.apache.activemq.command.SessionId)

Example 23 with ConnectionId

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

the class DestinationMapTempDestinationTest method testtestTempDestinations.

public void testtestTempDestinations() throws Exception {
    ConnectionId id = new ConnectionId(new IdGenerator().generateId());
    DestinationMap map = new DestinationMap();
    Object value = new Object();
    int count = 1000;
    for (int i = 0; i < count; i++) {
        ActiveMQTempQueue queue = new ActiveMQTempQueue(id, i);
        map.put(queue, value);
    }
    for (int i = 0; i < count; i++) {
        ActiveMQTempQueue queue = new ActiveMQTempQueue(id, i);
        map.remove(queue, value);
        Set<?> set = map.get(queue);
        assertTrue(set.isEmpty());
    }
}
Also used : ConnectionId(org.apache.activemq.command.ConnectionId) IdGenerator(org.apache.activemq.util.IdGenerator) ActiveMQTempQueue(org.apache.activemq.command.ActiveMQTempQueue)

Example 24 with ConnectionId

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

the class FailoverTransportBrokerTest method createConnectionInfo.

protected ConnectionInfo createConnectionInfo() throws Exception {
    ConnectionInfo info = new ConnectionInfo();
    info.setConnectionId(new ConnectionId("connection:" + (++idGenerator)));
    info.setClientId(info.getConnectionId().getValue());
    return info;
}
Also used : ConnectionId(org.apache.activemq.command.ConnectionId) ConnectionInfo(org.apache.activemq.command.ConnectionInfo)

Example 25 with ConnectionId

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

the class FailoverTransportTest method testCommandsIgnoredWhenOffline.

@Test(timeout = 30000)
public void testCommandsIgnoredWhenOffline() throws Exception {
    this.transport = createTransport();
    assertNotNull(failoverTransport);
    ConnectionStateTracker tracker = failoverTransport.getStateTracker();
    assertNotNull(tracker);
    ConnectionId id = new ConnectionId("1");
    ConnectionInfo connection = new ConnectionInfo(id);
    // Track a connection
    tracker.track(connection);
    try {
        this.transport.oneway(new RemoveInfo(new ConnectionId("1")));
    } catch (Exception e) {
        fail("Should not have failed to remove this known connection");
    }
    try {
        this.transport.oneway(new RemoveInfo(new ConnectionId("2")));
    } catch (Exception e) {
        fail("Should not have failed to remove this unknown connection");
    }
    this.transport.oneway(new MessageAck());
    this.transport.oneway(new ShutdownInfo());
}
Also used : ConnectionId(org.apache.activemq.command.ConnectionId) RemoveInfo(org.apache.activemq.command.RemoveInfo) MessageAck(org.apache.activemq.command.MessageAck) ConnectionStateTracker(org.apache.activemq.state.ConnectionStateTracker) ConnectionInfo(org.apache.activemq.command.ConnectionInfo) ShutdownInfo(org.apache.activemq.command.ShutdownInfo) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

ConnectionId (org.apache.activemq.command.ConnectionId)30 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)7 RemoveInfo (org.apache.activemq.command.RemoveInfo)3 SessionId (org.apache.activemq.command.SessionId)3 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)2 ConsumerId (org.apache.activemq.command.ConsumerId)2 MessageAck (org.apache.activemq.command.MessageAck)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 IllegalStateException (javax.jms.IllegalStateException)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 AMQConsumer (org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConsumer)1 AMQSession (org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSession)1 BrokerService (org.apache.activemq.broker.BrokerService)1 ConnectionContext (org.apache.activemq.broker.ConnectionContext)1 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)1 ActiveMQTempQueue (org.apache.activemq.command.ActiveMQTempQueue)1 BrokerId (org.apache.activemq.command.BrokerId)1 BrokerInfo (org.apache.activemq.command.BrokerInfo)1 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)1