Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ConsumerInfo


    }

    public void testMatchConsumer(){
        String destName = "foo.bar";
        ActiveMQTopic topic = new ActiveMQTopic(destName);
        ConsumerInfo info = new ConsumerInfo();
        info.setDestination(topic);
       
        ActiveMQTopic advisoryDest = new ActiveMQTopic(ActiveMQDestination.CONSUMER_ADVISORY_PREFIX + destName);
        ConsumerInfo advisory = new ConsumerInfo();
        advisory.setDestination(advisoryDest);
        AdvisorySupport test = new AdvisorySupport();
        assertTrue(test.matchConsumer(advisory, info));
    }
View Full Code Here


        ActiveMQTopic topic = new ActiveMQTopic(destName);
        ProducerInfo info = new ProducerInfo();
        info.setDestination(topic);
       
        ActiveMQTopic advisoryDest = new ActiveMQTopic(ActiveMQDestination.PRODUCER_ADVISORY_PREFIX + destName);
        ConsumerInfo advisory = new ConsumerInfo();
        advisory.setDestination(advisoryDest);
        AdvisorySupport test = new AdvisorySupport();
        assertTrue(test.matchProducer(advisory, info));
    }
View Full Code Here

        String destName = "foo.bar";
        ConnectionInfo info = new ConnectionInfo();
       
       
        ActiveMQTopic advisoryDest = new ActiveMQTopic(ActiveMQDestination.CONNECTION_ADVISORY_PREFIX + destName);
        ConsumerInfo advisory = new ConsumerInfo();
        advisory.setDestination(advisoryDest);
        AdvisorySupport test = new AdvisorySupport();
        assertTrue(test.matchConnection(advisory, info));
    }
View Full Code Here

    assertTrue(reader.getPacketType()==Packet.CONSUMER_INFO);
  }

  public void testReadPacket()
  {
    ConsumerInfo info = new ConsumerInfo();
    info.setConsumerId(consumerId);
    info.setConsumerNo(this.consumerNo);
        info.setPrefetchNumber(this.prefetchNumber);
    info.setClientId(this.clientId);
    info.setConsumerName(this.subscriberName);
    info.setSelector(this.selector);
    info.setDestination(this.destination);
    info.setStartTime(this.startTime);
    info.setStarted(this.started);
   
    ConsumerInfoWriter writer = new ConsumerInfoWriter();
    ConsumerInfoReader reader = new ConsumerInfoReader();
    try {
    byte[] data = writer.writePacketToByteArray(info);
    ConsumerInfo testInfo = (ConsumerInfo) reader.readPacketFromByteArray(data);
   
      assertTrue(testInfo.getConsumerId().equals(this.consumerId));
      assertTrue(testInfo.getConsumerNo()==this.consumerNo);
            assertTrue(testInfo.getPrefetchNumber() == this.prefetchNumber);
      assertTrue(testInfo.getClientId().equals(this.clientId));
      assertTrue(testInfo.getConsumerName().equals(this.subscriberName));
      assertTrue(testInfo.getSelector().equals(this.selector));
      assertTrue(testInfo.getDestination().equals(this.destination));
      assertTrue(testInfo.getStartTime() == this.startTime);
      assertTrue(testInfo.isStarted()==this.started);
    }catch(Throwable e){
      e.printStackTrace();
      assertTrue(false);
    }
  }
View Full Code Here

    }
  }
 
  public void testTime(){

    ConsumerInfo info = new ConsumerInfo();
    info.setConsumerId(this.consumerId);
    info.setConsumerNo(this.consumerNo);
        info.setPrefetchNumber(this.prefetchNumber);
    info.setClientId(this.clientId);
    info.setConsumerName(this.subscriberName);
    info.setSelector(this.selector);
    info.setDestination(this.destination);
    info.setStartTime(this.startTime);
    info.setStarted(this.started);
   
    ConsumerInfoWriter writer = new ConsumerInfoWriter();
    ConsumerInfoReader reader = new ConsumerInfoReader();
    ConsumerInfo testInfo = null;
    try {
      int count = 100000;
      long startTime = System.currentTimeMillis();
      for (int i = 0; i < count; i++){
        byte[] data = writer.writePacketToByteArray(info);
View Full Code Here

     * @throws IOException thrown if an error occurs
     */

    public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
        super.writePacket(packet, dataOut);
        ConsumerInfo info = (ConsumerInfo) packet;
        super.writeUTF(info.getConsumerId(),dataOut);
        super.writeUTF(info.getClientId(), dataOut);
        dataOut.writeShort(info.getSessionId());
        super.writeUTF(info.getSelector(), dataOut);
        super.writeUTF(info.getConsumerName(), dataOut);
        dataOut.writeInt(info.getConsumerNo());
        dataOut.writeShort(info.getPrefetchNumber());
        dataOut.writeLong(info.getStartTime());
        dataOut.writeBoolean(info.isStarted());
        dataOut.writeBoolean(info.isReceiptRequired());
        dataOut.writeBoolean(info.isNoLocal());
        dataOut.writeBoolean(info.isBrowser());
        ActiveMQDestination.writeToStream(info.getDestination(), dataOut);

    }
View Full Code Here

    /**
     * @return a new Packet instance
     */

    public Packet createPacket() {
        return new ConsumerInfo();
    }
View Full Code Here

     * @throws IOException
     */

    public void buildPacket(Packet packet, DataInput dataIn) throws IOException {
        super.buildPacket(packet, dataIn);
        ConsumerInfo info = (ConsumerInfo) packet;
        info.setConsumerId(dataIn.readUTF());
        info.setClientId(dataIn.readUTF());
        info.setSessionId(dataIn.readShort());
        info.setSelector(dataIn.readUTF());
        info.setConsumerName(dataIn.readUTF());
        info.setConsumerNo(dataIn.readInt());
        info.setPrefetchNumber(dataIn.readShort());
        info.setStartTime(dataIn.readLong());
        info.setStarted(dataIn.readBoolean());
        info.setReceiptRequired(dataIn.readBoolean());
        info.setNoLocal(dataIn.readBoolean());
        info.setBrowser(dataIn.readBoolean());
        info.setDestination(ActiveMQDestination.readFromStream(dataIn));
    }
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.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.