views:

647

answers:

2

I'm using the NMS API for reading/writing ActiveMQ in C#, and I cannot find a way to preview the messages on a queue. I could read and rollback - but that'll make them DLQ eventually.

In my previous life, TIBCO had a QueueBrowser object that could be used, and I think JMS had IQueueBrowser as well. I cannot find an ActiveMQ .NET equivalent.

+2  A: 

Unfortunately, NMS does not have support (at least not yet) for the QueueBrowser API available in JMS from Java. Take a look at Issue AMQNET-97 in the ActiveMQ.NET issue tracker database-- the team is looking for contributors to implement this feature.

BTW, you're not the only one asking for this-- here's another thread on the same topic.

At first I was hoping that Spring.NET's JMS support (for TIBCO) would also include ActiveMQ support QueueBrowser. Unfortunately, this isn't the case-- according to the Spring.NET documentation, only TIBCO is supported via Spring.NET's JMS API:

Note that JMS support is currently provided only for TIBCO's JMS implementation named TIBCO Enterprise Message Service (EMS). There is no fundamental reason why other vendors are not supported. It has just been a practical reason at this time since there isn’t a de facto JMS API in .NET that each vendor is required to implement. As such, each vendor ends up creating their own .NET inspired copy of the Java JMS API. The open source project .Net Message Service API (NMS) goal is to provide such a common API and it will very likely be used for future JMS work in Spring.NET.

So, in conclusion, unless you're willing to code in Java (or call into java libraries using one of the .NET-to-Java interop mechanisms), I don't think it will be easy for you to to get at QueueBrowser in the short term, although long-term this feature will probably make it into NMS at some point.

Justin Grant
Thanks! I'll most likely award you the bounty, but I'm goinbg to give it the weekend to see if anything else pans out. I'd love advice on how to implement this in .NET - even if it means contributing to NMS itself.
TheSoftwareJedi
If you want to contribute, try posting a comment to that effect on http://issues.apache.org/activemq/browse/AMQNET-97, you might get some interest! :-)
Justin Grant
+1  A: 

Actually, ActiveMQ supports JMX so you might be able to build one using a .NET JMX library (google netMX for this)

Noctris
Thanks for this pointer... It led to me searching around for things and I eventually settled on using Hermes, which is an open source JMS queue admin tool. It's not perfect, but it does what I need, and I don't need to build anything!
TheSoftwareJedi
Also, just for anyone else reading this, JMX support doesn't really give what I need and is extremely confusing with MBean and java stuff - not really C# relevant, unless I was missing something.
TheSoftwareJedi
Again, for anyone reading this, one major issue I had with Hermes is that ObjectMessage types were trying to be read as java objects and there was no way to override this to tell it to view as a string (I used soapformatter). I was forced to change all of my messages to TextMessage just so I could leverage the admin features in Hermes. I wrote a quick helper method to manually soapformat the messages in all message points.
TheSoftwareJedi