Hi,

Adding to the information below, if I change the junit test case that tries 
sending a message through artemis into "NativeProcessMsgReader" to use AMQP 
(rather than the core api), I get the stack trace:

Exception in thread "Thread-1" java.lang.IndexOutOfBoundsException: 
readerIndex(25) + length(276496418) exceeds writerIndex(294): 
DuplicatedByteBuf(ridx: 25, widx: 294, cap: 512, unwrapped: 
UnpooledHeapByteBuf(ridx: 17, widx: 294, cap: 512))
      at 
io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1165)
      at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:675)
      at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:683)
      at io.netty.buffer.WrappedByteBuf.readBytes(WrappedByteBuf.java:511)
      at 
org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readSimpleStringInternal(ChannelBufferWrapper.java:90)
      at 
org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readStringInternal(ChannelBufferWrapper.java:113)
      at 
org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readString(ChannelBufferWrapper.java:96)
      at 
com.advanced365.transoft.renault.poc.decforms.asyncmsg.c2java.NativeProcessMsgReader.run(NativeProcessMsgReader.java:132)

It is interesting to note that "NativeProcessMsgReader.java:132" links to this 
line:

              String receivedMsg = msgReceived.getBodyBuffer().readString();

Which is the line I thought was causing trouble when the code ran in Tomcat...


Next, I modified "NativeProcessMsgReader" to use Qpid AMQP client to read 
messages from Artemis (with the test case still sending messages using AMQP) - 
this worked perfectly.

So it seems that:

*       if the producer and consumer use the same protocol, messages flow 
through ok.

*       If the producer users AMQP API and the consumer uses Artemis Core API 
then there is a problem

For now I'll stick with using AMQP at both ends.

I'm still curious to know if it's reasonable to expect using an AMQP producer 
and an Artemis Core consumer to work?

Cheers, Andy

From: Andy Redhead [mailto:andy.redh...@oneadvanced.com]
Sent: 01 September 2016 23:03
To: users@activemq.apache.org
Subject: Artemis Core consumer hangs when reading message sent by AMQP producer

Hi,

I'm running Artemis 1.3.0 embedded inside a spring app running in Tomcat.

I have a remote message producer (NumberGuessMain.java) that uses the Apache 
Qpid Proton library to push messages onto an Artemis queue with the URL:

              amqp://localhost:5672/native-2-java

The messages created by the producer are JSON strings.

I have a single threaded, singleton consumer that uses the native Artemis API 
(NativeProcessMsgReader.java) running inside the same web app as Artemis, 
reading from the queue:

              native-2-java

While there are no messages to read, the consumer happily loops through the 
while loop in the "run" method.

As soon as the consumer tries to read the body of the first message, it hangs 
on the line:

              String receivedMsg = msgReceived.getBodyBuffer().readString();

The last lines in the log file are:

2016-09-01T22:27:26,270 15137 [Thread-6] DEBUG 
c.a.t.r.p.d.a.c.NativeProcessMsgReader - run - no message during last read 
period
2016-09-01T22:27:26,270 15137 [Thread-6] DEBUG 
c.a.t.r.p.d.a.c.NativeProcessMsgReader - run - in while loop, waiting for 
message
2016-09-01T22:27:26,772 15639 [Thread-6] DEBUG 
c.a.t.r.p.d.a.c.NativeProcessMsgReader - run - no message during last read 
period
2016-09-01T22:27:26,772 15639 [Thread-6] DEBUG 
c.a.t.r.p.d.a.c.NativeProcessMsgReader - run - in while loop, waiting for 
message
2016-09-01T22:27:26,912 15779 [Thread-6] DEBUG 
c.a.t.r.p.d.a.c.NativeProcessMsgReader - run - received non-null message
2016-09-01T22:27:26,912 15779 [Thread-6] DEBUG 
c.a.t.r.p.d.a.c.NativeProcessMsgReader - run - non-null message, body length: 
307

To me this looks like the message has reached Artemis and is made available to 
the consumer but something goes wrong when the consumer tries to access the 
body of the message.

I'm new to Artemis and AMQP so it's quite possible I'm doing something stupid...

Is the basic assumption that it's ok to send a message using AMQP and receive 
it using Artemis core API valid?

Is there something obvious in the code that is causing this problem?

Any pointers gratefully received.

Cheers, Andy

[cid:image012.png@01D17AF7.D972DF70]<http://www.oneadvanced.com/>
Andy Redhead
Principal Consultant > Solutions > Advanced
________________________

Advanced
230 City Road, London, EC1V 2TT
t: 020 7880 8888 > m: 0781 392 5246

www.oneadvanced.com<http://www.oneadvanced.com/>
[cid:image018.png@01D17AF7.D972DF70] <http://www.linkedin.com/company/2426258> 
[cid:image019.png@01D17AF7.D972DF70] <https://twitter.com/Going_Advanced>
> A Sunday Times Top Track 250 Company 2015
> Ranked in UK's 50 fastest growing technology companies 2014


***** Email confidentiality *****

This message is private and confidential. If you have received this message in 
error, please notify us and remove it from your system. The dissemination, 
copying or distribution of this message, or related files, by anyone other than 
the intended recipient is strictly prohibited.



Any views or opinions expressed are solely those of the author and do not 
necessarily represent those of Advanced 365 Limited.



***** Email monitoring *****

Advanced 365 Limited may monitor email traffic data and also the content of 
email for the purposes of security and staff training.



***** Email security *****

In keeping with good computing practice, the recipient of this email should 
ensure that it is virus-free. Advanced 365 Limited does not accept 
responsibility for any virus that may be transferred by way of this email.



Email may be susceptible to data corruption, interception and/or unauthorised 
amendment. Advanced 365 Limited does not accept liability for any such 
corruption, interception or amendment or any consequences thereof.



This email has been scanned for viruses by the Symantec Email Security.cloud 
service.



Advanced 365 Limited, part of the Advanced Computer Software Group

Registered office: Ditton Park, Riding Court Road, Datchet, Berkshire, SL3 9LL, 
UK

Registered in England under number 2124540

________________________________

Please consider the environment: Think before you print!

***** Email confidentiality *****

This message is private and confidential. If you have received this message in 
error, please notify us and remove it from your system. The dissemination, 
copying or distribution of this message, or related files, by anyone other than 
the intended recipient is strictly prohibited.



Any views or opinions expressed are solely those of the author and do not 
necessarily represent those of Advanced 365 Limited.



***** Email monitoring *****

Advanced 365 Limited may monitor email traffic data and also the content of 
email for the purposes of security and staff training.



***** Email security *****

In keeping with good computing practice, the recipient of this email should 
ensure that it is virus-free. Advanced 365 Limited does not accept 
responsibility for any virus that may be transferred by way of this email.



Email may be susceptible to data corruption, interception and/or unauthorised 
amendment. Advanced 365 Limited does not accept liability for any such 
corruption, interception or amendment or any consequences thereof.



This email has been scanned for viruses by the Symantec Email Security.cloud 
service.



Advanced 365 Limited, part of the Advanced Computer Software Group

Registered office: Ditton Park, Riding Court Road, Datchet, Berkshire, SL3 9LL, 
UK

Registered in England under number 2124540

Reply via email to