Package org.activemq.message

Examples of org.activemq.message.ProducerInfo


                        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


     * @throws IOException thrown if an error occurs
     */

    public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
        super.writePacket(packet, dataOut);
        ProducerInfo info = (ProducerInfo) packet;
        dataOut.writeShort(info.getProducerId());
        super.writeUTF(info.getClientId(), dataOut);
        dataOut.writeShort(info.getSessionId());
        dataOut.writeLong(info.getStartTime());
        dataOut.writeBoolean(info.isStarted());
        ActiveMQDestination.writeToStream(info.getDestination(), dataOut);
    }
View Full Code Here

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

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

     * @throws IOException
     */

    public void buildPacket(Packet packet, DataInput dataIn) throws IOException {
        super.buildPacket(packet, dataIn);
        ProducerInfo info = (ProducerInfo) packet;
        info.setProducerId(dataIn.readShort());
        info.setClientId(dataIn.readUTF());
        info.setSessionId(dataIn.readShort());
        info.setStartTime(dataIn.readLong());
        info.setStarted(dataIn.readBoolean());
        info.setDestination(ActiveMQDestination.readFromStream(dataIn));
    }
View Full Code Here

        // ensure that the connection info is sent to the broker
        connection.sendConnectionInfoToBroker();
        //start listening for advisories if the destination is temporary
        this.connection.startAdvisoryForTempDestination(producer.defaultDestination);
        producer.setProducerId(connection.handleIdGenerator.getNextShortSequence());
        ProducerInfo info = createProducerInfo(producer);
        info.setStarted(true);
        this.connection.syncSendPacket(info);
        this.producers.add(producer);
    }
View Full Code Here

     */
    protected void removeProducer(ActiveMQMessageProducer producer) throws JMSException {
        this.producers.remove(producer);
        if (!closed) {
            this.connection.stopAdvisoryForTempDestination(producer.defaultDestination);
            ProducerInfo info = createProducerInfo(producer);
            info.setStarted(false);
            this.connection.asyncSendPacket(info, false);
        }
    }
View Full Code Here

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

    protected ProducerInfo createProducerInfo(ActiveMQMessageProducer producer) throws JMSException {
        ProducerInfo info = new ProducerInfo();
        info.setProducerId(producer.getProducerId());
        info.setClientId(connection.clientID);
        info.setSessionId(this.sessionId);
        info.setDestination(producer.defaultDestination);
        info.setStartTime(producer.getStartTime());
        return info;
    }
View Full Code Here

        }
        assertFalse(started.get());
    }

    public void onEvent(ProducerAdvisoryEvent event) {
        ProducerInfo info = event.getInfo();
        started.set(info.isStarted());
        synchronized(started){
            started.notify();
        }
       
    }
View Full Code Here

        ProducerInfoReader reader = new ProducerInfoReader();
        assertTrue(reader.getPacketType() == Packet.PRODUCER_INFO);
    }

    public void testReadPacket() {
        ProducerInfo info = new ProducerInfo();
        info.setId(this.id);
        info.setClientId(this.clientId);
        info.setDestination(this.destination);
        info.setStartTime(this.startTime);
        info.setStarted(this.started);

        ProducerInfoWriter writer = new ProducerInfoWriter();
        ProducerInfoReader reader = new ProducerInfoReader();
        try {
            byte[] data = writer.writePacketToByteArray(info);
            ProducerInfo testInfo = (ProducerInfo) reader.readPacketFromByteArray(data);

            assertTrue(testInfo.getId() == this.id);
            assertTrue(testInfo.getClientId().equals(this.clientId));
            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() {

        ProducerInfo info = new ProducerInfo();
        info.setId(this.id);
        info.setClientId(this.clientId);
        info.setDestination(this.destination);
        info.setStartTime(this.startTime);
        info.setStarted(this.started);

        ProducerInfoWriter writer = new ProducerInfoWriter();
        ProducerInfoReader reader = new ProducerInfoReader();
        ProducerInfo 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

TOP

Related Classes of org.activemq.message.ProducerInfo

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.