Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ProducerInfo


     * @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


     * @param msg
     */
    public void onMessage(Message msg){
        if (msg instanceof ObjectMessage){
            try {
                ProducerInfo info = (ProducerInfo)((ObjectMessage)msg).getObject();
                ProducerAdvisoryEvent event = new ProducerAdvisoryEvent(info);
                fireEvent(event);
            }
            catch (JMSException e) {
                log.error("Failed to process message: " + msg);
View Full Code Here

     */
    protected void addProducer(ActiveMQMessageProducer producer) throws JMSException {
        // ensure that the connection info is sent to the broker
        connection.sendConnectionInfoToBroker();
        producer.setProducerId(connection.handleIdGenerator.getNextShortSequence());
        ProducerInfo info = createProducerInfo(producer);
        info.setStarted(true);
        this.connection.syncSendPacket(info);
        this.producers.add(producer);
    }
View Full Code Here

     * @throws JMSException
     */
    protected void removeProducer(ActiveMQMessageProducer producer) throws JMSException {
        this.producers.remove(producer);
        if (!closed.get()) {
            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

                            ConsumerInfo info = (ConsumerInfo) packet;
                            consumeConsumerInfo(info);
                            break;
                        }
                        case Packet.PRODUCER_INFO : {
                            ProducerInfo info = (ProducerInfo) packet;
                            consumeProducerInfo(info);
                            break;
                        }
                        case Packet.SESSION_INFO : {
                            SessionInfo info = (SessionInfo) packet;
View Full Code Here

                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

                    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());
                    }
                    for (Iterator i = sessions.iterator();i.hasNext();) {
                        SessionInfo si = (SessionInfo) i.next();
                        si.setClientId(info.getClientId());
                    }
View Full Code Here

                        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

TOP

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