org.apache.activemq.command.ConsumerControl

Here are the examples of the java api class org.apache.activemq.command.ConsumerControl taken from open source projects.

1. ConsumerControlTest#populateObject()

Project: activemq-artemis
File: ConsumerControlTest.java
@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConsumerControl info = (ConsumerControl) object;
    info.setClose(true);
    info.setConsumerId(createConsumerId("ConsumerId:1"));
    info.setPrefetch(1);
    info.setFlush(false);
    info.setStart(true);
    info.setStop(false);
}

2. ConsumerControlTest#populateObject()

Project: activemq-artemis
File: ConsumerControlTest.java
@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConsumerControl info = (ConsumerControl) object;
    info.setClose(true);
    info.setConsumerId(createConsumerId("ConsumerId:1"));
    info.setPrefetch(1);
    info.setFlush(false);
    info.setStart(true);
    info.setStop(false);
}

3. ZeroPrefetchConsumerTest#testBrokerZeroPrefetchConfigWithConsumerControl()

Project: activemq-artemis
File: ZeroPrefetchConsumerTest.java
// https://issues.apache.org/jira/browse/AMQ-4234
// https://issues.apache.org/jira/browse/AMQ-4235
public void testBrokerZeroPrefetchConfigWithConsumerControl() throws Exception {
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(brokerZeroQueue);
    assertEquals("broker config prefetch in effect", 0, consumer.info.getCurrentPrefetchSize());
    // verify sub view broker
    // I comment out this because it checks broker internal
    // which doesn't apply to artemis broker.
    //Subscription sub = broker.getRegionBroker().getDestinationMap().get(ActiveMQDestination.transform(brokerZeroQueue)).getConsumers().get(0);
    //assertEquals("broker sub prefetch is correct", 0, sub.getConsumerInfo().getCurrentPrefetchSize());
    // manipulate Prefetch (like failover and stomp)
    ConsumerControl consumerControl = new ConsumerControl();
    consumerControl.setConsumerId(consumer.info.getConsumerId());
    consumerControl.setDestination(ActiveMQDestination.transform(brokerZeroQueue));
    // default for a q
    consumerControl.setPrefetch(1000);
    Object reply = ((ActiveMQConnection) connection).getTransport().request(consumerControl);
    assertTrue("good request", !(reply instanceof ExceptionResponse));
    assertEquals("broker config prefetch in effect", 0, consumer.info.getCurrentPrefetchSize());
}

4. ConsumerControlTest#populateObject()

Project: activemq-artemis
File: ConsumerControlTest.java
@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ConsumerControl info = (ConsumerControl) object;
    info.setClose(true);
    info.setConsumerId(createConsumerId("ConsumerId:1"));
    info.setPrefetch(1);
}

5. ConsumerControlTest#createObject()

Project: activemq-artemis
File: ConsumerControlTest.java
@Override
public Object createObject() throws Exception {
    ConsumerControl info = new ConsumerControl();
    populateObject(info);
    return info;
}

6. ConsumerControlTest#createObject()

Project: activemq-artemis
File: ConsumerControlTest.java
@Override
public Object createObject() throws Exception {
    ConsumerControl info = new ConsumerControl();
    populateObject(info);
    return info;
}

7. ConsumerControlTest#createObject()

Project: activemq-artemis
File: ConsumerControlTest.java
@Override
public Object createObject() throws Exception {
    ConsumerControl info = new ConsumerControl();
    populateObject(info);
    return info;
}