4 Replies Latest reply on Jun 17, 2004 3:53 AM by mikehaberfield

    Subscribe to JBoss MQ Topic from .NET client?

    mikehaberfield

      Apologies if this should be in the JBoss.NET forum - but it's related to JBoss MQ pub/sub and .NET client...

      Could someone please clarify whether or not it is possible for a .NET client application (e.g. VB.NET, C#.NET etc.) to subscribe to a JBoss MQ
      publish/subscribe topic.

      I have a (fully working) Java application publishing messages (asynchronously) to a JBoss MQ topic and want to read them with a .NET client.

      Any pointers would be greatly appreciated.

      Many thanks,

      Mike

        • 1. Re: Subscribe to JBoss MQ Topic from .NET client?
          genman


          I have posted about this before. I can't seem to find it.

          Anyway, if you're just reading messages, what would be easiest would be to write a simple server in Java listening to some well-known port. (Write this as a JMX service.) Then, when a client connects, you read messages from the queue and write them to the socket.

          Sort of like this

          javax.jms.Connection c = ...;
          ServerSocket ss = new ServerSocket(1234);
          while (true) {
          Socket s = ss.accept();
          QueueSession qs = c.createQueueSession();
          new Thread(new Sender(s)).start();
          }

          class Sender implements Runnable {
          public void run() {
          QueueReader qr = qs.getQueueReader();
          while (true) {
          Message m = qr.read();
          s.getOutputStream().write( m );
          }
          }
          }

          If you need to get more sophisicated, you can probably write a .NET client that "talks" over the UIL2 protocol.

          (BTW, replace Queue with Topic if you're dealing with topics.)

          • 2. Re: Subscribe to JBoss MQ Topic from .NET client?
            genman


            Somebody already wrote a basic .NET client, I don't know if it works well or not.

            http://sourceforge.net/projects/csil

            It appears to use some sort of XML protocol, which has its associated overhead.

            • 3. Re: Subscribe to JBoss MQ Topic from .NET client?

              The csil client works well for subscribing to topics. The version in cvs right now can process messages quite rapidly, despite the overhead of encoding the jms messages into xml.

              • 4. Re: Subscribe to JBoss MQ Topic from .NET client?
                mikehaberfield

                I've implemented the soultion proposed in the first reply (simple Java<-->.NET bridge written in Java, using a socket to communicate with .NET client) and it'll do me fine for the moment.

                (Wouldn't it be nice if Mr Gates provided a fully compliant JMS library in .NET - it would just make everyone's lives so much simpler!)

                Many thanks to all those who responded.