5 Replies Latest reply on Sep 19, 2014 9:50 AM by jbertram

    How to disallow consuming all message in a HornetQ topic?

    hoahieusuong

      Hi there,

       

      I have a messaging system using HornetQ topic to broadcast message to clients. Every client has their client code. Client code is used as a selector to filter messages in the topic. The client is deployed at customer side. If the customer rewrite the client and remove the selector then this client can consume ALL message in the TOPIC. How to disallow a client without selector consuming messages in HornetQ Topic?

       

      Thanks

        • 1. Re: How to disallow consuming all message in a HornetQ topic?
          gaohoward

          I'm thinking you can disallow such client to be created by  using server side interceptors.

          1 of 1 people found this helpful
          • 2. Re: How to disallow consuming all message in a HornetQ topic?
            jbertram

            I don't know of anything built in to HornetQ that would allow you to prevent a client that wasn't a selector from establishing a subscription on a topic, but you might be able to use a cleverly written remoting interceptor to implement that functionality.  Check out the documentation and examples for more details on implementing a remoting interceptor.  You'll probably want to intercept the org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage message type which has "filterString" and "queueName" properties you can inspect.

            1 of 1 people found this helpful
            • 3. Re: How to disallow consuming all message in a HornetQ topic?
              hoahieusuong

              Thanks for quick reply!

              I'll try with interceptor ^^

              • 4. Re: How to disallow consuming all message in a HornetQ topic?
                hoahieusuong

                Justin Bertram wrote:

                 

                I don't know of anything built in to HornetQ that would allow you to prevent a client that wasn't a selector from establishing a subscription on a topic, but you might be able to use a cleverly written remoting interceptor to implement that functionality.  Check out the documentation and examples for more details on implementing a remoting interceptor.  You'll probably want to intercept the org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage message type which has "filterString" and "queueName" properties you can inspect.

                Hi Justin,

                 

                I tried to get the "filterString" and "queueName" from SessionCreateConsumerMessage on a jms queue, it's ok. But when I replaced a jms queue by a jms topic, the "filterString" is null. Btw, can you give me more message types for my issue (get "filterString" value of a subscription on a topic).

                • 5. Re: How to disallow consuming all message in a HornetQ topic?
                  jbertram

                  Try intercepting the org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage message type.  That is probably what is sent when the subscription is created.