3 Replies Latest reply on Jun 24, 2014 4:14 PM by Zheng Wang

    Interceptor Issue

    Zheng Wang Newbie

      Hi,

       

      I have a jms producer(transaction=false, AUTO_ACKNOWLEDGE) to publisher on a topic and put an interceptor on the server side. The interceptor will reject certain messages by return false on the boolean intercept(Packet packet, RemotingConnection connection) method.

       

      But once it returns false. The jms producer is blocked on org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(line 359).

       

      If my interceptor returns true, normally my jms producer will receive a NullResponseMessage. But when the interceptor returns false, it never receive this NullReponseMessage. My producer will wait at line 359 until timeout(30 seconds)

       

      Did I miss something?

       

      Thanks a lot

        • 1. Re: Interceptor Issue
          Zheng Wang Newbie

          Dig deeper, I think the problem is indeed the sever doesn't send the ack back to the producer.

           

          Here's my guess: hornetq will only ack if it persist the message. As my interceptor sits in the middle and drops the "bad" messages, server never has a chance to send back ack for bad messages. Then my producer will hang.

           

          So basically interceptor cannot drop message(return false) in a persistent mode. Or I should somehow fake the server ack.

          • 2. Re: Interceptor Issue
            Andy Taylor Master

            as the documentation states Interceptors are powerful but dangerous. If you return false for a packet then you need some internal understanding of what this will effect, as in your case where the message is never processed and the ack returned. Its best to only ever change packets or audit packets and always return true.

             

            If you simply want to avoid the message going to a queue then you could always change the address and send it elsewhere.

            • 3. Re: Interceptor Issue
              Zheng Wang Newbie

              Thanks a lot Andy. Redirecting the message sounds interesting. I will try it.

               

              Another question: I checked the doc(chapter 47). I don't find information about performance impact. Is interceptor run in more than one thread ? If you could please share some interceptor performance insight, it would be great.