Re: TextMessage.getText returning null
Try turning the broker and client logging up to trace and see what the
logging shows for the message content.
Also, try the following:
- Same test with a Java producer (using plain ActiveMQ libs) instead of the
- Same test with a Java consumer (using plain ActiveMQ libs) instead of a
- Use the "tcp" transport instead of the "nio" transport
Anyway, the goal I would say is to trace the problem to the point of
hand-off between the broker and client. For example, the following
questions come to mind (for the problematic messages):
- Is the broker receiving the body over the wire (i.e. tcp connection)?
- Is the broker sending the body over the wire?
- Is the client library receiving the body from the application?
- Is the client library sending the body to the application?
Hope this helps.
On Wed, May 30, 2018 at 2:41 PM, codingismy11to7 <steven@xxxxxxxxxxxxxx>
> We recently updated from (ancient) ActiveMQ 5.10.x to 5.15.4. I've noticed
> that text messages are now sporadically returning null as their message
> bodies when they were sent with bodies.
> After failing to make a unit test showing this error, I created a project
> that reproduces part of what our software is doing, which reliably
> replicates the race condition (my last run got null message bodies on
> of messages). I was able to vastly simplify what our software is doing and
> still reproduce, but when I tried to simplify further the issue stopped
> Reproduction and full explanation:
> Since I don't have a self-contained unit test I was hesitant to open an
> issue directly and decided to send a message here instead.
> I'm a Scala/Akka developer, so I used the tools I was comfortable with to
> make this reproduction without writing a lot of code, but I'm sure somebody
> more comfortable in Java and the ActiveMQ API could reproduce in a unit
> test. I'm assuming it has something to do with multiple Sessions consuming
> the same topic and calling TextMessage.getText at the same time.
> Any suggestions of what to do next?
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-Dev-