Hi Kristinn, the acknowledgements confirm the successful consumption of a message to the server and generally it doesn't control directly the flow of data between the server and the client[1].
Using the messaging group suitably, only one consumer will receive the messages of a queue and if your consumer is slow you could set consumerWindowSize to 0 (for no buffer at all)[2] to limit the redeliveries on disconnection. So using the messaging group and setting consumerWindowSize to 0, the server sends all the messages of a queue to one consumer and the consumer doesn't receive the next message before invoking the `receive()` method or asynchronously via a message listener. If this solution doesn't match your requirements, the activemq-client 5 offers a way to control the delivery with the acknowledgements using prefetch limit [3]. Why do you need to lock the delivery of the next message until the acknowledgement of the previous one? [1] https://activemq.apache.org/components/artemis/documentation/latest/flow-control.html [2] https://activemq.apache.org/components/artemis/documentation/latest/flow-control.html#slow-consumers [3] https://activemq.apache.org/what-is-the-prefetch-limit-for Regards, Domenico Il giorno lun 6 lug 2020 alle ore 09:50 Kristinn Thor Johannsson < [email protected]> ha scritto: > Thanks a lot for the response Domenico. > > I see what I failed to mention in my original question is that each > consumer might need a while to process a message from each queue it's > handling. > In your example, you had auto-acknowledge, making each message being > instantly handled by the consumer. > > Is your example modifiable to make it so that a message takes about 1 > second to be handled and acknowledged, and the consumer doesn't receive the > next message for the same queue before that happens? > If so, I'm certain our use case can be handled by artemis. > > > fre. 3. jul. 2020 kl. 13:02 skrev Domenico Francesco Bruscino < > [email protected]>: > > > Hi Kristinn, > > > > I have just answered the same question on stackoverflow: > > > > > https://stackoverflow.com/questions/62701025/activemq-artemis-handle-messages-sequentially/62705413#62705413 > > > > Regards, > > Domenico > > > > Il giorno gio 18 giu 2020 alle ore 10:51 Kristinn Thor Johannsson < > > [email protected]> ha scritto: > > > > > Hi, I've tried to ensure that a consumer on a queue (with message > > grouping) > > > will only receive one message at a time from each queue it's handling, > > > until the consumer acknowledges said message. > > > > > > For a test I've set up ActiveMQ Artemis and have 3 consumers on a > > wildcard > > > EXAMPLE.* , and one publisher posting 10 messages to each of 5 queues: > > > EXAMPLE.1 - EXAMPLE.5 . What I'm seeing is that each of the consumers > > > receive messages from the queues immediately. I've tried using the > > consumer > > > window size setting (as 0) as I thought that would help me only deliver > > one > > > message at a time from each queue, but that doesn't seem to work. Have > I > > > misunderstood that setting? If so, are there any other settings I > should > > be > > > looking at to help me get this working? > > > > > > The particular use case I'm trying to achieve is that I'll possibly > have > > > many queues and a couple of consumers. And it's important that messages > > in > > > each of the queues are handled sequentially, but all queues can be > > handled > > > in parallell > > > > > > -- > > > -Kristinn Thor > > > > > > > > -- > -Kristinn Thor >
