Search in sources :

Example 41 with ConsumerInfo

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

the class ConsumerInfoTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConsumerInfo info = (ConsumerInfo) object;
    info.setConsumerId(createConsumerId("ConsumerId:1"));
    info.setBrowser(true);
    info.setDestination(createActiveMQDestination("Destination:2"));
    info.setPrefetchSize(1);
    info.setMaximumPendingMessageLimit(2);
    info.setDispatchAsync(false);
    info.setSelector("Selector:3");
    info.setSubscriptionName("SubscriptionName:4");
    info.setNoLocal(true);
    info.setExclusive(false);
    info.setRetroactive(true);
    info.setPriority((byte) 1);
    {
        BrokerId[] value = new BrokerId[2];
        for (int i = 0; i < 2; i++) {
            value[i] = createBrokerId("BrokerPath:5");
        }
        info.setBrokerPath(value);
    }
    info.setAdditionalPredicate(createBooleanExpression("AdditionalPredicate:6"));
    info.setNetworkSubscription(false);
    info.setOptimizedAcknowledge(true);
    info.setNoRangeAcks(false);
}
Also used : ConsumerInfo(org.apache.activemq.command.ConsumerInfo)

Example 42 with ConsumerInfo

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

the class ConsumerInfoTest method createObject.

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

Example 43 with ConsumerInfo

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

the class ConsumerInfoTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConsumerInfo info = (ConsumerInfo) object;
    info.setConsumerId(createConsumerId("ConsumerId:1"));
    info.setBrowser(true);
    info.setDestination(createActiveMQDestination("Destination:2"));
    info.setPrefetchSize(1);
    info.setMaximumPendingMessageLimit(2);
    info.setDispatchAsync(false);
    info.setSelector("Selector:3");
    info.setSubscriptionName("SubcriptionName:4");
    info.setNoLocal(true);
    info.setExclusive(false);
    info.setRetroactive(true);
    info.setPriority((byte) 1);
    {
        BrokerId[] value = new BrokerId[2];
        for (int i = 0; i < 2; i++) {
            value[i] = createBrokerId("BrokerPath:5");
        }
        info.setBrokerPath(value);
    }
    info.setAdditionalPredicate(createBooleanExpression("AdditionalPredicate:6"));
    info.setNetworkSubscription(false);
    info.setOptimizedAcknowledge(true);
    info.setNoRangeAcks(false);
}
Also used : ConsumerInfo(org.apache.activemq.command.ConsumerInfo)

Example 44 with ConsumerInfo

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

the class ConsumerInfoTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConsumerInfo info = (ConsumerInfo) object;
    info.setConsumerId(createConsumerId("ConsumerId:1"));
    info.setBrowser(true);
    info.setDestination(createActiveMQDestination("Destination:2"));
    info.setPrefetchSize(1);
    info.setMaximumPendingMessageLimit(2);
    info.setDispatchAsync(false);
    info.setSelector("Selector:3");
    info.setSubscriptionName("SubscriptionName:4");
    info.setNoLocal(true);
    info.setExclusive(false);
    info.setRetroactive(true);
    info.setPriority((byte) 1);
    {
        BrokerId[] value = new BrokerId[2];
        for (int i = 0; i < 2; i++) {
            value[i] = createBrokerId("BrokerPath:5");
        }
        info.setBrokerPath(value);
    }
    info.setAdditionalPredicate(createBooleanExpression("AdditionalPredicate:6"));
    info.setNetworkSubscription(false);
    info.setOptimizedAcknowledge(true);
    info.setNoRangeAcks(false);
    {
        ConsumerId[] value = new ConsumerId[2];
        for (int i = 0; i < 2; i++) {
            value[i] = createConsumerId("NetworkConsumerPath:7");
        }
        info.setNetworkConsumerPath(value);
    }
}
Also used : ConsumerInfo(org.apache.activemq.command.ConsumerInfo)

Example 45 with ConsumerInfo

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

the class DiscoveryTransportBrokerTest method testPublisherFailsOver.

public void testPublisherFailsOver() throws Exception {
    ActiveMQDestination destination = new ActiveMQQueue("TEST");
    int deliveryMode = DeliveryMode.NON_PERSISTENT;
    // Start a normal consumer on the local broker
    StubConnection connection1 = createConnection();
    ConnectionInfo connectionInfo1 = createConnectionInfo();
    SessionInfo sessionInfo1 = createSessionInfo(connectionInfo1);
    ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
    connection1.send(connectionInfo1);
    connection1.send(sessionInfo1);
    connection1.request(consumerInfo1);
    // Start a normal consumer on a remote broker
    StubConnection connection2 = createRemoteConnection();
    ConnectionInfo connectionInfo2 = createConnectionInfo();
    SessionInfo sessionInfo2 = createSessionInfo(connectionInfo2);
    ConsumerInfo consumerInfo2 = createConsumerInfo(sessionInfo2, destination);
    connection2.send(connectionInfo2);
    connection2.send(sessionInfo2);
    connection2.request(consumerInfo2);
    // Start a failover publisher.
    StubConnection connection3 = createFailoverConnection();
    ConnectionInfo connectionInfo3 = createConnectionInfo();
    SessionInfo sessionInfo3 = createSessionInfo(connectionInfo3);
    ProducerInfo producerInfo3 = createProducerInfo(sessionInfo3);
    connection3.send(connectionInfo3);
    connection3.send(sessionInfo3);
    connection3.send(producerInfo3);
    // Send the message using the fail over publisher.
    connection3.request(createMessage(producerInfo3, destination, deliveryMode));
    // The message will be sent to one of the brokers.
    FailoverTransport ft = connection3.getTransport().narrow(FailoverTransport.class);
    // See which broker we were connected to.
    StubConnection connectionA;
    StubConnection connectionB;
    TransportConnector serverA;
    if (connector.getServer().getConnectURI().getPort() == ft.getConnectedTransportURI().getPort()) {
        connectionA = connection1;
        connectionB = connection2;
        serverA = connector;
    } else {
        connectionA = connection2;
        connectionB = connection1;
        serverA = remoteConnector;
    }
    assertNotNull(receiveMessage(connectionA));
    assertNoMessagesLeft(connectionB);
    // Dispose the server so that it fails over to the other server.
    LOG.info("Disconnecting active server");
    serverA.stop();
    LOG.info("Sending request that should failover");
    connection3.request(createMessage(producerInfo3, destination, deliveryMode));
    assertNotNull(receiveMessage(connectionB));
    assertNoMessagesLeft(connectionA);
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) ConsumerInfo(org.apache.activemq.command.ConsumerInfo) ProducerInfo(org.apache.activemq.command.ProducerInfo) StubConnection(org.apache.activemq.broker.StubConnection) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) SessionInfo(org.apache.activemq.command.SessionInfo) FailoverTransport(org.apache.activemq.transport.failover.FailoverTransport) ConnectionInfo(org.apache.activemq.command.ConnectionInfo) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination)

Aggregations

ConsumerInfo (org.apache.activemq.command.ConsumerInfo)115 Message (org.apache.activemq.command.Message)77 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)76 SessionInfo (org.apache.activemq.command.SessionInfo)76 ProducerInfo (org.apache.activemq.command.ProducerInfo)72 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)45 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)25 StubConnection (org.apache.activemq.broker.StubConnection)17 MessageAck (org.apache.activemq.command.MessageAck)17 XATransactionId (org.apache.activemq.command.XATransactionId)15 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)12 Test (org.junit.Test)12 DataArrayResponse (org.apache.activemq.command.DataArrayResponse)9 TransactionInfo (org.apache.activemq.command.TransactionInfo)9 ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)8 LocalTransactionId (org.apache.activemq.command.LocalTransactionId)8 RemoveInfo (org.apache.activemq.command.RemoveInfo)8 DestinationStatistics (org.apache.activemq.broker.region.DestinationStatistics)7 Response (org.apache.activemq.command.Response)7 MessageReference (org.apache.activemq.broker.region.MessageReference)6