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.
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.
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.