Search in sources :

Example 36 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 37 with ConsumerInfo

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

the class NetworkRouteTest method addAndRemoveOppositeOrder.

@Test
public void addAndRemoveOppositeOrder() throws Exception {
    // from (1)
    localBroker.request(EasyMock.isA(ConsumerInfo.class));
    ArgHolder localConsumer = ArgHolder.holdArgsForLastObjectCall();
    // from (2a)
    remoteBroker.asyncRequest(EasyMock.isA(ActiveMQMessage.class), EasyMock.isA(ResponseCallback.class));
    ArgHolder firstMessageFuture = ArgHolder.holdArgsForLastFutureRequestCall();
    localBroker.oneway(EasyMock.isA(MessageAck.class));
    // from (2b)
    remoteBroker.asyncRequest(EasyMock.isA(ActiveMQMessage.class), EasyMock.isA(ResponseCallback.class));
    ArgHolder secondMessageFuture = ArgHolder.holdArgsForLastFutureRequestCall();
    localBroker.oneway(EasyMock.isA(MessageAck.class));
    // from (3)
    localBroker.oneway(EasyMock.isA(RemoveInfo.class));
    ExpectationWaiter waitForRemove = ExpectationWaiter.waiterForLastVoidCall();
    control.replay();
    // (1) send advisory of path 1
    remoteListener.onCommand(path1Msg);
    msgDispatch.setConsumerId(((ConsumerInfo) localConsumer.arguments[0]).getConsumerId());
    // send advisory of path 2, doesn't send a ConsumerInfo to localBroker
    remoteListener.onCommand(path2Msg);
    // (2a) send a message
    localListener.onCommand(msgDispatch);
    ResponseCallback callback = (ResponseCallback) firstMessageFuture.arguments[1];
    FutureResponse response = new FutureResponse(callback);
    response.set(new Response());
    // send advisory of path 2 remove, doesn't send a RemoveInfo to localBroker
    remoteListener.onCommand(removePath2Msg);
    // (2b) send a message
    localListener.onCommand(msgDispatch);
    callback = (ResponseCallback) secondMessageFuture.arguments[1];
    response = new FutureResponse(callback);
    response.set(new Response());
    // (3) send advisory of path 1 remove, sends a RemoveInfo to localBroker
    remoteListener.onCommand(removePath1Msg);
    waitForRemove.assertHappens(5, TimeUnit.SECONDS);
    // send a message, does not send message as in 2a and 2b
    localListener.onCommand(msgDispatch);
    control.verify();
}
Also used : Response(org.apache.activemq.command.Response) FutureResponse(org.apache.activemq.transport.FutureResponse) ConsumerInfo(org.apache.activemq.command.ConsumerInfo) RemoveInfo(org.apache.activemq.command.RemoveInfo) FutureResponse(org.apache.activemq.transport.FutureResponse) ResponseCallback(org.apache.activemq.transport.ResponseCallback) MessageAck(org.apache.activemq.command.MessageAck) ActiveMQMessage(org.apache.activemq.command.ActiveMQMessage) Test(org.junit.Test)

Example 38 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 39 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 40 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)

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