Package org.apache.activemq.command

Examples of org.apache.activemq.command.ConsumerControl


public class ConsumerControlTest extends BaseCommandTestSupport {

    public static final ConsumerControlTest SINGLETON = new ConsumerControlTest();

    public Object createObject() throws Exception {
        ConsumerControl info = new ConsumerControl();
        populateObject(info);
        return info;
    }
View Full Code Here


        return info;
    }

    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);

    }
View Full Code Here


    public static final ConsumerControlTest SINGLETON = new ConsumerControlTest();

    public Object createObject() throws Exception {
        ConsumerControl info = new ConsumerControl();
        populateObject(info);
        return info;
    }
View Full Code Here

        return info;
    }

    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);
    }
View Full Code Here


    public static final ConsumerControlTest SINGLETON = new ConsumerControlTest();

    public Object createObject() throws Exception {
        ConsumerControl info = new ConsumerControl();
        populateObject(info);
        return info;
    }
View Full Code Here

        return info;
    }

    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);
    }
View Full Code Here

        ConnectionState connectionState = connectionStates.get(connectionId);
        if (connectionState != null) {
            connectionState.setConnectionInterruptProcessingComplete(true);
            Map<ConsumerId, ConsumerInfo> stalledConsumers = connectionState.getRecoveringPullConsumers();
            for (Entry<ConsumerId, ConsumerInfo> entry: stalledConsumers.entrySet()) {
                ConsumerControl control = new ConsumerControl();
                control.setConsumerId(entry.getKey());
                control.setPrefetch(entry.getValue().getPrefetchSize());
                control.setDestination(entry.getValue().getDestination());
                try {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("restored recovering consumer: " + control.getConsumerId() + " with: " + control.getPrefetch());
                    }
                    transport.oneway(control)
                } catch (Exception ex) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Failed to submit control for consumer: " + control.getConsumerId()
                                + " with: " + control.getPrefetch(), ex);
                    }
                }
            }
            stalledConsumers.clear();
        }
View Full Code Here

                                            + maxSlowCount +  ") or too long (>"
                                            + maxSlowDuration + "): " + entry.getKey().getConsumerInfo().getConsumerId()));
                                }}, 0l);
                        } else {
                            // just abort the consumer by telling it to stop
                            ConsumerControl stopConsumer = new ConsumerControl();
                            stopConsumer.setConsumerId(entry.getKey().getConsumerInfo().getConsumerId());
                            stopConsumer.setClose(true);
                            connection.dispatchAsync(stopConsumer);
                        }
                    } else {
                        LOG.debug("slowConsumer abort ignored, no connection in context:"  + connectionContext);
                    }
View Full Code Here

     * @param newPrefetch
     */
    @Override
    public void updateConsumerPrefetch(int newPrefetch) {
        if (context != null && context.getConnection() != null && context.getConnection().isManageable()) {
            ConsumerControl cc = new ConsumerControl();
            cc.setConsumerId(info.getConsumerId());
            cc.setPrefetch(newPrefetch);
            context.getConnection().dispatchAsync(cc);
        }
    }
View Full Code Here

        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));
        consumerControl.setPrefetch(1000); // default for a q

        Object reply = ((ActiveMQConnection) connection).getTransport().request(consumerControl);
        assertTrue("good request", !(reply instanceof ExceptionResponse));
        assertEquals("broker config prefetch in effect", 0, consumer.info.getCurrentPrefetchSize());
        assertEquals("broker sub prefetch is correct", 0, sub.getConsumerInfo().getCurrentPrefetchSize());
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.ConsumerControl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.