Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQMessage


                if (brokerConnection) {
                    packet.addBrokerVisited(remoteBrokerName); //got from the remote broker
                    packet.addBrokerVisited(brokerName);
                }
                if (packet.isJMSMessage()) {
                    ActiveMQMessage message = (ActiveMQMessage) packet;
                    // lets mark all messages from where they came from so that NoLocal can filter out loops
                    // e.g. when receiving messages over multicast, we don't want to publish them back out again
                    if (connectionInfo != null) {
                        message.setProducerID(connectionInfo.getClientId());
                    }
                    else {
                        log.warn("No connection info available! Maybe the client forgot to start() the Connection?");
                    }
                    if (!brokerConnection) {
                        message.setEntryBrokerName(brokerName);
                        message.setEntryClusterName(clusterName);
                    }
                    consumeActiveMQMessage(message);
                }
                else {
                    switch (packet.getPacketType()) {
View Full Code Here


                    for (Iterator i = producers.iterator();i.hasNext();) {
                        ProducerInfo pi = (ProducerInfo) i.next();
                        pi.setClientId(info.getClientId());
                    }
                    for (int i = 0;i < dispatchQueue.size();i++) {
                        ActiveMQMessage msg = (ActiveMQMessage) dispatchQueue.get(i);
                        dispatch(msg);
                    }
                    dispatchQueue.clear();
                }
                if (started.get() && !info.isStarted()) {
View Full Code Here

    public Message receive() throws JMSException {
        checkClosed();
        session.setSessionConsumerDispatchState(ActiveMQSession.CONSUMER_DISPATCH_SYNC);
        try {
            this.accessThread = Thread.currentThread();
            ActiveMQMessage message = (ActiveMQMessage) messageQueue.dequeue();
            this.accessThread = null;
            if (message != null) {
                boolean expired = message.isExpired();
                messageDelivered(message, true,expired);
                if (!expired){
                message = message.shallowCopy();
                }else {
                    message = (ActiveMQMessage) receiveNoWait(); //this will remove any other expired messages held in the queue
                }
            }
            return message;
View Full Code Here

        try {
            if (timeout == 0) {
                return this.receive();
            }
            this.accessThread = Thread.currentThread();
            ActiveMQMessage message = (ActiveMQMessage) messageQueue.dequeue(timeout);
            this.accessThread = null;
            if (message != null) {
                boolean expired = message.isExpired();
                messageDelivered(message, true,expired);
                if (!expired){
                message = message.shallowCopy();
                }else {
                    message = (ActiveMQMessage) receiveNoWait(); //this will remove any other expired messages held in the queue
                }
            }
            return message;
View Full Code Here

     */
    public Message receiveNoWait() throws JMSException {
        checkClosed();
        session.setSessionConsumerDispatchState(ActiveMQSession.CONSUMER_DISPATCH_SYNC);
        try {
            ActiveMQMessage message = null;
            //iterate through an scrub delivered but expired messages
            while ((message = (ActiveMQMessage)messageQueue.dequeueNoWait())!= null){
                boolean expired = message.isExpired();
                messageDelivered(message,true,expired);
                if (!expired){
                    return message.shallowCopy();
                }
            }
        }
        catch (InterruptedException ioe) {
            throw new JMSException("Queue is interrupted: " + ioe.getMessage());
View Full Code Here

    public TestSupport(String name) {
        super(name);
    }

    protected ActiveMQMessage createMessage() {
        return new ActiveMQMessage();
    }
View Full Code Here

    protected void assertFilterMatches(Filter filter, String subject, boolean expected) throws JMSException {
        Destination destination = createDestination(subject);
       
        // lets create a Message now
        ActiveMQMessage message = createMessage();
        message.setJMSDestination(destination);

        boolean actual = filter.matches(message);
        assertEquals("Matching " + filter + " to: " + destination, expected, actual);
    }
View Full Code Here

     * @see org.codehaus.activemq.message.PacketListener#consume(org.codehaus.activemq.message.Packet)
     */
    public void consume(Packet packet) {
        if (!closed.get() && packet != null) {
            if (packet.isJMSMessage()) {
                ActiveMQMessage message = (ActiveMQMessage) packet;
                message.setReadOnly(true);
                message.setProducerID(clientID);

                try {
                    int count = 0;
                    for (Iterator i = this.messageDispatchers.iterator(); i.hasNext();) {
                        ActiveMQMessageDispatcher dispatcher = (ActiveMQMessageDispatcher) i.next();
                        if (dispatcher.isTarget(message)) {
                            if (count > 0) {
                                //separate message for each Session etc.
                                message = message.deepCopy();
                            }
                            dispatcher.dispatch(message);
                            count++;
                        }
                    }
View Full Code Here

    public Message receive() throws JMSException {
        checkClosed();
        session.setSessionConsumerDispatchState(ActiveMQSession.CONSUMER_DISPATCH_SYNC);
        try {
            this.accessThread = Thread.currentThread();
            ActiveMQMessage message = (ActiveMQMessage) messageQueue.dequeue();
            this.accessThread = null;
            if (message != null) {
                messageDelivered(message, true);
                message = message.shallowCopy();
            }
            return message;
        }
        catch (InterruptedException ioe) {
            return null;
View Full Code Here

        try {
            if (timeout == 0) {
                return this.receive();
            }
            this.accessThread = Thread.currentThread();
            ActiveMQMessage message = (ActiveMQMessage) messageQueue.dequeue(timeout);
            this.accessThread = null;
            if (message != null) {
                messageDelivered(message, true);
                message = message.shallowCopy();
            }
            return message;
        }
        catch (InterruptedException ioe) {
            return null;
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ActiveMQMessage

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.