tags:

views:

33

answers:

2

Hello all. I'm trying to consume messages on an ActiveMQ topic from a C# application. I'm using the 1.3 .net release, and I don't receive any messages.

I have existing code that uses older libraries (and libraries built on top of libraries that I don't want to use or upgrade) that work fine, so I know messages are travelling along the topic, but my simple program with newer libraries just doesn't see them.

I'm using code copied and pasted from http://remark.wordpress.com/articles/publish-subscribe-with-activemq-and-nms/ as my test. The SimpleTopicSubscriber (with a simple change to make it a non-durable consumer) just doesn't receive anything. The SimpleTopicPublisher works just fine - I can send a simple message and it gets through, no problem.

Looking at the JMX console, I can see my subscriber connect, see that it's on the right topic, but it just doesn't get any messages.

Any ideas? I've even tried using the 1.2 libraries, but that didn't make any difference.

Thanks Matt

A: 

There are a couple reasons why your client might not be receiving messages, one could be that you didn't call Connection.Start(), without that the message pump won't start dispatching messages to your client. The other reason might be that your now non-durable Topic subscriber was started after the publisher in which case there'd be no messages delivered since you are using a Topic and Topics are like queue's in that once a message is sent its forgotten about so a subscriber that joins up later doesn't receive any messages that were sent before it subscribed.

Regards Tim.

Open Source Integration: http://fusesource.com

Tim Bish
Thanks Tim, unfortunately, I'm definitely calling Start, and I've set my publisher to send a message every 30 seconds...
citizenmatt
Can you post your source code to the ActiveMQ users group, I will take a look and see what is going on.Regards Tim.Open Source Integration: http://fusesource.com
Tim Bish
Thanks for the help - turns out it was half my fault and half issues with wire formats...
citizenmatt
+1  A: 

Turns out there were 2 problems. I edited the example code incorrectly and passed in a durable consumer id instead of a selector. Not terribly clever.

Once I'd fixed this, I could receive messages, but only with the 1.1 release of the NMS/ActiveMq dlls. I couldn't receive messages with version 1.2 or 1.3.

But if I pass wireformat.version=2 as a parameter when connecting, everything works ok. The broker is 5.0.0 and I strongly suspect this would work ok with a later version of the broker.

Thanks Matt

citizenmatt