Package org.activemq.message

Examples of org.activemq.message.ConsumerInfo


        return new DurableTopicSubscription(new DispatcherImpl(), client, consumerInfo, filter, new RedeliveryPolicy(),new DeadLetterPolicy());
    }

    protected ConsumerInfo createConsumerInfo() {
        ConsumerInfo answer = new ConsumerInfo();
        answer.setClientId(getClientID());
        answer.setConsumerId(idGenerator.generateId());
        answer.setConsumerName(getConsumerName());
        answer.setDestination(destination);
        answer.setPrefetchNumber(100);
        answer.setSessionId((short)123);
        answer.setStarted(true);
        return answer;
    }
View Full Code Here


    public void addSubscription(Subscription s)
    {
        if (subscriptions.containsKey(s.getDestination()))
        {
            Subscription old = (Subscription) subscriptions.get(s.getDestination());
            ConsumerInfo p = old.close();
            enqueuePacket(p);
            subscriptions.put(s.getDestination(), s);
        }
        else
        {
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

        connectionInfo.setUserName(userName);
        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

        this.ackMode = clientAck;
    }

    public ConsumerInfo close()
    {
        ConsumerInfo unsub = new ConsumerInfo();
        unsub.setStarted(false);
        unsub.setDestination(this.destination);
        unsub.setClientId(format.getClientId());
        unsub.setConsumerNo(consumer_no);
        return unsub;
    }
View Full Code Here

        this.format = format;
    }

    public PacketEnvelope build(String commandLine, DataInput in) throws IOException
    {
        ConsumerInfo ci = new ConsumerInfo();
        Properties headers = headerParser.parse(in);
        String destination = headers.getProperty(Stomp.Headers.Subscribe.DESTINATION);
        ActiveMQDestination actual_dest  = DestinationNamer.convert(destination);
        ci.setDestination(DestinationNamer.convert(destination));
        ci.setStarted(true);
        ci.setStartTime(System.currentTimeMillis());
        ci.setClientId(format.getClientId());
        short consumer_no = StompWireFormat.clientIds.getNextShortSequence();
        ci.setConsumerNo(consumer_no);
        ci.setReceiptRequired(true);
        ci.setSessionId(format.getSessionId());
        while (in.readByte() != 0) {}
        String consumerId = StompWireFormat.clientIds.generateId();
        ci.setConsumerId(consumerId);
        Subscription s = new Subscription(format, consumer_no, consumerId);
        s.setDestination(actual_dest);
        String ack_mode_key = headers.getProperty(Stomp.Headers.Subscribe.ACK_MODE);
        if (ack_mode_key != null && ack_mode_key.equals(Stomp.Headers.Subscribe.AckModeValues.CLIENT))
        {
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

  public ConnectionConsumer createConnectionConsumer(Topic topic,
      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.setConsumerNo(handleIdGenerator.getNextShortSequence());
    return new ActiveMQConnectionConsumer(this, sessionPool, info,
        maxMessages);
  }
View Full Code Here

  public ConnectionConsumer createConnectionConsumer(Queue queue,
      String messageSelector, ServerSessionPool sessionPool,
      int maxMessages) throws JMSException {
    checkClosed();
    ensureClientIDInitialised();
    ConsumerInfo info = new ConsumerInfo();
    info.setConsumerId(this.handleIdGenerator.generateId());
    info.setDestination(ActiveMQMessageTransformation
        .transformDestination(queue));
    info.setSelector(messageSelector);
    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.