I just have startet using hornetQ an lack experience with message queues in general. So please have a little patience with me if I don not get something...
OK, let me tell you what I am trying to do. I have devloped a processing unit for messages coming in from external, tcp-connected devices. I intend to use hornetQ as some kind of message box. There is only one global 'inbox' queue for all devices. As a consumer to this inbox queue I have set up a thread pool of workers, each having its own hornetQ ClientSession. When my IO-layer receives a message from a device it checks syntax and puts it in the inbox-queue. One of the threads receives the messages and performs processing and after that acknowledges the message. So far the easy part :-)
Now there is also an outbox queue or more precisely there is an outbox queue for each and every distinct device. When a processor of an inbox message works on a message, it in turn produces response messages for the device. These response messages go into the outbox queue of that device. So more formaly the processor workers are consumers to the inbox queue and producers to the outbox queues. As a consumer to the outbox queue I have also set up a thread pool of workers each with an own ClientSession. Each of theses workers iterates over the available queues and trys to receive a message with a relatively short timeout. If it gets a message it uses the IO-layer to transport the message to the correct device. Here is the difficulty: the device's protocol says that a message sent to a device may only be deleted by the sender after an acknowledgement is send by the device. So the outbox worker cannot acknowledge the hornetq message right away. I have made a picture to illustrate what I try to explain:
You can treat the 'CommTask' and 'dev' icons as the devices in my explanation.
Now that's my actual question: How can I acknowledge messages with delay?
Maybe I have chosen the wrong approach and somone has a better view to such scenarios. Any hint is welcome.
Thanks in advance,