Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ConsumerInfo


                            TransactionInfo info = (TransactionInfo) packet;
                            consumeTransactionInfo(info);
                            break;
                        }
                        case Packet.CONSUMER_INFO : {
                            ConsumerInfo info = (ConsumerInfo) packet;
                            consumeConsumerInfo(info);
                            break;
                        }
                        case Packet.PRODUCER_INFO : {
                            ProducerInfo info = (ProducerInfo) packet;
View Full Code Here


                log.debug(this + " has started running client version " + info.getClientVersion() + " , wire format = " + info.getWireFormatVersion());
              
                this.brokerConnector.registerClient(this, info);
                //go through consumers and producers - setting their clientId (which might not have been set)
                for (Iterator i = consumers.iterator();i.hasNext();) {
                    ConsumerInfo ci = (ConsumerInfo) i.next();
                    ci.setClientId(info.getClientId());
                }
                for (Iterator i = producers.iterator();i.hasNext();) {
                    ProducerInfo pi = (ProducerInfo) i.next();
                    pi.setClientId(info.getClientId());
                }
            }
            if (info.isStarted()) {
                //register any consumers
                for (Iterator i = consumers.iterator();i.hasNext();) {
                    ConsumerInfo ci = (ConsumerInfo) i.next();
                    if (activeConsumers.add(ci)) {
                        this.brokerConnector.registerMessageConsumer(this, ci);
                    }
                }
            }
            else {
                log.debug(this + " has stopped");
                //de-register any consumers
                for (Iterator i = consumers.iterator();i.hasNext();) {
                    ConsumerInfo ci = (ConsumerInfo) i.next();
                    if (activeConsumers.remove(ci)) {
                        this.brokerConnector.deregisterMessageConsumer(this, ci);
                    }
                }
            }
View Full Code Here

        if (!cleanedUp) {
            cleanedUp = true;
            try {
                try {
                    for (Iterator i = consumers.iterator();i.hasNext();) {
                        ConsumerInfo info = (ConsumerInfo) i.next();
                        info.setStarted(false);
                        this.brokerConnector.deregisterMessageConsumer(this, info);
                    }
                    for (Iterator i = producers.iterator();i.hasNext();) {
                        ProducerInfo info = (ProducerInfo) i.next();
                        info.setStarted(false);
                        this.brokerConnector.deregisterMessageProducer(this, info);
                    }
                    for (Iterator i = sessions.iterator();i.hasNext();) {
                        SessionInfo info = (SessionInfo) i.next();
                        info.setStarted(false);
                        this.brokerConnector.deregisterSession(this, info);
                    }
                    for (Iterator i = transactions.iterator();i.hasNext();) {
                        this.brokerConnector.rollbackTransaction(this, i.next().toString());
                    }
View Full Code Here

     * @return true if a
     */
    public boolean hasConsumerFor(ActiveMQDestination destination) {
        for (Iterator i = subscriptions.iterator();i.hasNext();) {
            TransientTopicSubscription ts = (TransientTopicSubscription) i.next();
            ConsumerInfo info = ts.getConsumerInfo();
            if (info.getDestination().matches(destination)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

     * @param msg
     */
    public void onMessage(Message msg) {
        if (msg instanceof ObjectMessage) {
            try {
                ConsumerInfo info = (ConsumerInfo) ((ObjectMessage) msg).getObject();
                updateActiveConsumers(info);
                ConsumerAdvisoryEvent event = new ConsumerAdvisoryEvent(info);
                fireEvent(event);
            }
            catch (JMSException e) {
View Full Code Here

     * @return true if a
     */
    public boolean hasConsumerFor(ActiveMQDestination destination) {
        for (Iterator i = subscriptions.iterator();i.hasNext();) {
            TransientTopicSubscription ts = (TransientTopicSubscription) i.next();
            ConsumerInfo info = ts.getConsumerInfo();
            if (info.getDestination().matches(destination)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        connection.sendConnectionInfoToBroker();
        // lets add the stat
        if (consumer.isDurableSubscriber()) {
            stats.onCreateDurableSubscriber();
        }
        ConsumerInfo info = createConsumerInfo(consumer);
        info.setStarted(true);
        //we add before notifying the server - as messages could
        //start to be dispatched before receipt from syncSend()
        //is returned
        this.consumers.add(consumer);
        if (started.get()){
View Full Code Here

        // lets remove the stat
        if (consumer.isDurableSubscriber()) {
            stats.onRemoveDurableSubscriber();
        }
        if (!closed) {
            ConsumerInfo info = createConsumerInfo(consumer);
            info.setStarted(false);
            this.connection.asyncSendPacket(info, false);
        }
    }
View Full Code Here

            this.connection.asyncSendPacket(info, false);
        }
    }

    protected ConsumerInfo createConsumerInfo(ActiveMQMessageConsumer consumer) throws JMSException {
        ConsumerInfo info = new ConsumerInfo();
        info.setConsumerId(consumer.consumerIdentifier);
        info.setClientId(connection.clientID);
        info.setSessionId(this.sessionId);
        info.setConsumerNo(consumer.consumerNumber);
        info.setPrefetchNumber(consumer.prefetchNumber);
        info.setDestination(consumer.destination);
        info.setNoLocal(consumer.noLocal);
        info.setBrowser(consumer.browser);
        info.setSelector(consumer.messageSelector);
        info.setStartTime(consumer.startTime);
        info.setConsumerName(consumer.consumerName);
        return info;
    }
View Full Code Here

     * @return true if a
     */
    public boolean hasConsumerFor(ActiveMQDestination destination) {
        for (Iterator i = subscriptions.iterator();i.hasNext();) {
            TransientTopicSubscription ts = (TransientTopicSubscription) i.next();
            ConsumerInfo info = ts.getConsumerInfo();
            if (info.getDestination().matches(destination)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ConsumerInfo

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.