HI,
We do an order consolidation process on some of our inbound order messages which sounds similar to what you are after.
To do this we use two threads:
One to collect messages from the client and store them in a gdbm database
A second that pulls the messages from the database and consolidates them. This is on a timed schedule to allow enough time for the client drop off all the orders in a batch.
If you can afford to wait and group messages for a given time frame this will work, however if anything comes in after the cut-off time it will be it’s own message.
I am not sure exactly what problems you are running into but I am attaching out code in case our code might help.
The attached DOC will give a better explanation of how the tcl code works.