qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robbie Gemmell <robbie.gemm...@gmail.com>
Subject Re: Connecting to RabbitMQ using QPid client
Date Wed, 10 Jun 2015 15:15:16 GMT
Hi Mansour,

AMQP is a wire protocol, whereas JMS is an API, which you can
implement using any suitable underlying protocol desired. The Qpid JMS
clients use various versions of AMQP to do so, while many other
providers implement it over other common open or proprietary
protocols.

Qpid Proton is an AMQP 1.0  protocol engine library that can be
embedded within applications/brokers/clients that surface their own
APIs (e.g. as it is in the new Qpid JMS client) or protocols, or can
be used directly via its APIs as a client (e.g via the emerging
reactive API bindings). What client API you should use depends on your
use case and what you actually need/want to do.

Your JNDI configuration options mentioned below includes config for
both the older AMQP 1.0 JMS client and the new Proton-based Qpid JMS
client. Both the stacktraces are from the new client however, which
your later config is for. Either way, they both only support AMQP 1.0,
so you will need to ensure you have AMQP 1.0 support enabled in your
Qpid or RabbitMQ brokers to use those clients (or swap to using the
AMQP 0-x JMS client if you want to use JMS without AMQP 1.0). RabbitMQ
uses AMQP 0-9-1, and has an AMQP 1.0 plugin. AMQP 1.0 is enabled by
default on the Qpid Java broker and can be enabled for the Qpid C++
broker by loading the amqp.so module. Which Qpid broker are you
actually using?

It appears you did get connected to the Qpid broker, as it looks to be
attempting to create a producer when the TCP connection got reset. It
isnt clear it got that far against RabbitMQ. It might be helpful to
enable the protocol trace logging, as covered at:
http://qpid.apache.org/releases/qpid-jms-0.2.0/docs/index.html#logging.

The Python client you mention supports AMQP 0-9-1 and so wont work
against the Qpid C++ broker (which uses AMQP 0-10 and AMQP 1.0), but
might against the Qpid Java broker (which supports AMQP 0-8, 0-9,
0-9-1, 0-10, and 1.0).

The maven dependencies for the various JMS clients are listed at
http://qpid.apache.org/maven.html

Robbie

On 10 June 2015 at 14:29, Mansour Al Akeel <mansour.alakeel@gmail.com> wrote:
> Hello,
>
>  I am a bit confused by the compatibily issues between different
> versions of the AMPQ, and lost in the documentation.
>
> First thing, as far as I know, AMQP is not JMS. There's a lot of
> examples QPid about JMS, which led me to include that in QPid, JMS is
> compatible with AMQP. Is this conclusiong correct ?
> Is it documented some where ??
>
>
> We have two components "QPid Proton" and "QPid JMS". Both are clients
> for AMQP. QPid JMS is built on Proton.
> Which one do I use ?
>
> Additionally, I am not sure about what mvn depencies to use with what.
> Then comes the URL and the initial factory part. Looking at the
> examples, was not a lot of help, as I am testing agains RabbitMQ, and
> don't know when I am hitting an issue, if it's compatability or I am
> doing something wrong.
>
> Here's the initial factory options we have,
>
>
> java.naming.factory.initial = org.apache.qpid.jms.jndi.JmsInitialContextFactory
> java.naming.factory.initial =
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
> java.naming.factory.initial =
> org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory
>
> Then the URL format,
> connectionfactory.localhost =
> amqp://guest:guest@localhost:5672?clientid=test-client&remote-host=default
> connectionfactory.localhost = amqp://guest:guest@localhost:5672
> connectionfactory.localhost = amqp://localhost:5672
>
> I have read these pages, but still lost:
>
> https://cwiki.apache.org/confluence/display/qpid/AMQP+compatibility
> https://www.rabbitmq.com/interoperability.html
>
> Now, my issue is connecting using QPid client to both RabbitMQ and
> QPid broker 0.32
>
> I am just doing the simple HelloWord example:
>
> Here's my jndi:
> java.naming.factory.initial = org.apache.qpid.jms.jndi.JmsInitialContextFactory
> connectionfactory.localhost = amqp://localhost:5672
> queue.myQueue = git-repo-name
>
> maven:
>         <dependency>
>             <groupId>org.apache.qpid</groupId>
>             <artifactId>qpid-jms-client</artifactId>
>             <version>0.2.0</version>
>         </dependency>
>
> Java:
>             Context context = new InitialContext();
>             ConnectionFactory factory = (ConnectionFactory)
> context.lookup("localhost");
>             Destination queue = (Destination) context.lookup("myQueue");
>             Connection connection = factory.createConnection(USER, PASSWORD);
>             connection.setExceptionListener(new MyExceptionListener());
>             connection.start();
>             Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>             MessageProducer producer = session.createProducer(queue);
>
>
> The error on the client when connecting to QPid:
>
> 2015-06-10 17:22:04,483 [localhost:5672]] - DEBUG AmqpAbstractResource
>           - AmqpSession { ID:localhost-48465-1433942523956-0:1:1 } is
> now open:
> 2015-06-10 17:22:04,488 [localhost:5672]] - DEBUG AmqpSession
>           - Creating AmqpFixedProducer for: git-repo-name
> 2015-06-10 17:22:04,495 [localhost:5672]] - TRACE NettyTcpTransport
>           - Attempted write of: 253 bytes
> 2015-06-10 17:22:07,498 [ntLoopGroup-2-1] - TRACE NettyTcpTransport
>           - Exception on channel! Channel is [id: 0x6ca00e8f,
> /127.0.0.1:44497 => localhost/127.0.0.1:5672]
> 2015-06-10 17:22:07,499 [localhost:5672]] - INFO  AmqpProvider
>           - Transport failed: Connection reset by peer
> 2015-06-10 17:22:07,500 [ntLoopGroup-2-1] - TRACE NettyTcpTransport
>           - Channel has gone inactive! Channel is [id: 0x6ca00e8f,
> /127.0.0.1:44497 :> localhost/127.0.0.1:5672]
> Connection ExceptionListener fired, exiting.
> 2015-06-10 17:22:07,501 [localhost:5672]] - DEBUG AmqpProvider
>           - Transport connection remotely closed
> javax.jms.JMSException: Connection reset by peer
>     at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:60)
>     at org.apache.qpid.jms.JmsConnection.onAsyncException(JmsConnection.java:1169)
>     at org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1085)
>     at org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:832)
>     at org.apache.qpid.jms.provider.amqp.AmqpProvider$17.run(AmqpProvider.java:688)
>     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
>     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:745)
> Caused by: java.io.IOException: Connection reset by peer
>     at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
>     at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
>     at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>     at sun.nio.ch.IOUtil.read(IOUtil.java:197)
>     at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
>     at io.netty.buffer.UnpooledHeapByteBuf.setBytes(UnpooledHeapByteBuf.java:256)
>     at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:871)
>     at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:208)
>     at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:108)
>     at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494)
>     at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461)
>     at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378)
>     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350)
>     at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
>     ... 1 more
>
>
>
> When connecting to rabbitMQ I am getting this client error:
>
> 015-06-10 12:04:54,395 [ntLoopGroup-2-1] - TRACE NettyTcpTransport
>          - Channel has gone inactive! Channel is [id: 0xc1361df3,
> /127.0.0.1:36720 :> localhost/127.0.0.1:5672]
> Connection ExceptionListener fired, exiting.
> 2015-06-10 12:04:54,397 [localhost:5672]] - DEBUG AmqpProvider
>           - Transport connection remotely closed
> javax.jms.JMSException: Connection reset by peer
>     at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:60)
>     at org.apache.qpid.jms.JmsConnection.onAsyncException(JmsConnection.java:1169)
>     at org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1085)
>     at org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:832)
>     at org.apache.qpid.jms.provider.amqp.AmqpProvider$17.run(AmqpProvider.java:688)
>     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
>     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:745)
> Caused by: java.io.IOException: Connection reset by peer
>     at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
>     at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
>     at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>     at sun.nio.ch.IOUtil.read(IOUtil.java:197)
>     at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
>     at io.netty.buffer.UnpooledHeapByteBuf.setBytes(UnpooledHeapByteBuf.java:256)
>     at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:871)
>     at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:208)
>     at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:108)
>     at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494)
>     at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461)
>     at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378)
>     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350)
>     at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
>     ... 1 more
>
> Please note that with rabbitMq, I am able to connect and send messages
> from Python using Pika:
>
> credentials = pika.PlainCredentials('guest', 'guest')
> parameters = pika.ConnectionParameters('localhost' , 5672 , '/'  , credentials )
> connection = pika.BlockingConnection( parameters )
> channel = connection.channel()
> #channel.queue_declare(queue='git-repo-name')
> for line in out.readlines():
>     channel.basic_publish(exchange='', routing_key='git-repo-name',
> body=line.rstrip() )
> connection.close()
>
>
> Any help is highly appreciated.
>
> Thank you
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message