Package org.activemq.message

Examples of org.activemq.message.ConsumerInfo


        // send consumers
        for (Iterator consumersIterator = session.consumers.iterator(); consumersIterator
            .hasNext();) {
          ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) consumersIterator
              .next();
          ConsumerInfo consumerInfo = session
              .createConsumerInfo(consumer);
          consumerInfo.setStarted(true);
          asyncSendPacket(consumerInfo, false);
        }
        // send producers
        for (Iterator producersIterator = session.producers.iterator(); producersIterator
            .hasNext();) {
View Full Code Here


        consumerID = idGenerator.generateId();
        return connectionInfo;
    }
   
    protected Packet createConsumerPacket(){
        ConsumerInfo info = new ConsumerInfo();
        info.setClientId(this.clientID);
        info.setConsumerNo(0);
        info.setStarted(true);
        info.setStartTime(System.currentTimeMillis());
        info.setDestination(createDestination("chat",this.userName));
        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

    }
   
    protected void process(Message msg) {
        if (msg instanceof ObjectMessage) {
            try {
                ConsumerInfo info = (ConsumerInfo) ((ObjectMessage) msg).getObject();
                ConsumerAdvisoryEvent event = new ConsumerAdvisoryEvent(info);
               
               
                boolean inDemand = isInDemand();

                if ( info.isStarted() ) {
                    consumerCount++;
                } else {
                    consumerCount--;
                }
               
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

        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

  public ConnectionConsumer createConnectionConsumer(Destination destination,
      String messageSelector, ServerSessionPool sessionPool,
      int maxMessages) throws JMSException {
    checkClosed();
    ensureClientIDInitialised();
    ConsumerInfo info = new ConsumerInfo();
    info.setConsumerId(handleIdGenerator.generateId());
    info.setDestination(ActiveMQMessageTransformation
        .transformDestination(destination));
    info.setSelector(messageSelector);
    info.setConsumerNo(handleIdGenerator.getNextShortSequence());
    return new ActiveMQConnectionConsumer(this, sessionPool, info,
        maxMessages);
  }
View Full Code Here

  public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
      String subscriptionName, String messageSelector,
      ServerSessionPool sessionPool, int maxMessages) throws JMSException {
    checkClosed();
    ensureClientIDInitialised();
    ConsumerInfo info = new ConsumerInfo();
    info.setConsumerId(this.handleIdGenerator.generateId());
    info.setDestination(ActiveMQMessageTransformation
        .transformDestination(topic));
    info.setSelector(messageSelector);
    info.setConsumerName(subscriptionName);
    info.setConsumerNo(handleIdGenerator.getNextShortSequence());
    return new ActiveMQConnectionConsumer(this, sessionPool, info,
        maxMessages);
  }
View Full Code Here

TOP

Related Classes of org.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.