You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Elliotte Harold <er...@gmail.com> on 2007/08/08 20:46:33 UTC

Can ActiveMQ 4 client read from an ActiveMQ 5 server?

I have some code that worked fairly well with the release version of
ActiveMQ 4.1 using OpenWire. One of my colleagues upgraded the server to the
latest snapshot of ActiveMQ 5, and suddenly while I could still write to the
queues on that server I could no longer read from them. (by the way, the new
web interface in ActiveMQ 5 is very nice. That's what let's me see that my
written messages are indeed arriving.

For example, this simple program to write a couple of messages and then read
them back fails:

import javax.jms.*;
import org.apache.activemq.*;
import org.apache.activemq.command.*;

public class CompletedRead {


    private static String url = "tcp://queue.example.com:61616";
    private static String queue = "foo";

        public static void main(String[] args) throws JMSException {

            ConnectionFactory out = new ActiveMQConnectionFactory(url);
            Connection connection = out.createConnection();
            Destination destination = new ActiveMQQueue( queue );
            connection.start();
            Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(destination);
            TextMessage message = session.createTextMessage();
            message.setText("118652");
            producer.send(message);
            message.setText("118653");
            producer.send(message);

            producer.close();
            session.close();
            connection.close();

            receive();
        }

        private static void receive() throws JMSException {
            ConnectionFactory in = new ActiveMQConnectionFactory(url);
            Connection connection = in.createConnection();
            Destination destination = new ActiveMQQueue( queue );
            connection.start();
            Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);

            MessageConsumer consumer = session.createConsumer(destination);
            TextMessage message = (TextMessage) consumer.receive(10000);
            System.out.println(message.getText());
            message = (TextMessage) consumer.receive(10000);
            System.out.println(message.getText());

            consumer.close();
            session.close();
            connection.close();

        }


Should an ActiveMQ 4 client be able to read from an ActiveMQ 5 server? Or
should it not be able to? Is this a known issue?

I'm going to try to upgrade my clients libraries to 5.0 and see what happens
next.


-- 
Elliotte Rusty Harold
erharold@gmail.com

Re: Can ActiveMQ 4 client read from an ActiveMQ 5 server?

Posted by Elliotte Harold <er...@gmail.com>.
On 8/8/07, Timothy Bish <ti...@sensis.com> wrote:
>
>
> If you find that the 5.0 client works and a 4.0 doesn't then I think we
> have an issue and you should create a new Jira issue for this.




I have now indeed verified that. Simply replacing the 4.1 jar in my client
with the 5.0 snapshot jar from August 7 makes it all happy. The messages are
sent and received as expected.

I will open a JIRA on this.

-- 
Elliotte Rusty Harold
erharold@gmail.com

Re: Can ActiveMQ 4 client read from an ActiveMQ 5 server?

Posted by Timothy Bish <ti...@sensis.com>.
This seems to be a reoccurring theme.  I've seen the same issue with the
C++ client and so far can't find anything wrong on the client end.  Also
there was a posting the other day from someone trying to use the .Net
client with a 5.0 broker and seeing the same behavior.  

I'm still tinkering with the C++ client.  

If you find that the 5.0 client works and a 4.0 doesn't then I think we
have an issue and you should create a new Jira issue for this.

Regards 
Tim

On Wed, 2007-08-08 at 14:46 -0400, Elliotte Harold wrote:
> I have some code that worked fairly well with the release version of
> ActiveMQ 4.1 using OpenWire. One of my colleagues upgraded the server to the
> latest snapshot of ActiveMQ 5, and suddenly while I could still write to the
> queues on that server I could no longer read from them. (by the way, the new
> web interface in ActiveMQ 5 is very nice. That's what let's me see that my
> written messages are indeed arriving.
> 
> For example, this simple program to write a couple of messages and then read
> them back fails:
> 
> import javax.jms.*;
> import org.apache.activemq.*;
> import org.apache.activemq.command.*;
> 
> public class CompletedRead {
> 
> 
>     private static String url = "tcp://queue.example.com:61616";
>     private static String queue = "foo";
> 
>         public static void main(String[] args) throws JMSException {
> 
>             ConnectionFactory out = new ActiveMQConnectionFactory(url);
>             Connection connection = out.createConnection();
>             Destination destination = new ActiveMQQueue( queue );
>             connection.start();
>             Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>             MessageProducer producer = session.createProducer(destination);
>             TextMessage message = session.createTextMessage();
>             message.setText("118652");
>             producer.send(message);
>             message.setText("118653");
>             producer.send(message);
> 
>             producer.close();
>             session.close();
>             connection.close();
> 
>             receive();
>         }
> 
>         private static void receive() throws JMSException {
>             ConnectionFactory in = new ActiveMQConnectionFactory(url);
>             Connection connection = in.createConnection();
>             Destination destination = new ActiveMQQueue( queue );
>             connection.start();
>             Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> 
>             MessageConsumer consumer = session.createConsumer(destination);
>             TextMessage message = (TextMessage) consumer.receive(10000);
>             System.out.println(message.getText());
>             message = (TextMessage) consumer.receive(10000);
>             System.out.println(message.getText());
> 
>             consumer.close();
>             session.close();
>             connection.close();
> 
>         }
> 
> 
> Should an ActiveMQ 4 client be able to read from an ActiveMQ 5 server? Or
> should it not be able to? Is this a known issue?
> 
> I'm going to try to upgrade my clients libraries to 5.0 and see what happens
> next.
> 
>