Skip to content

Question - Receiving Messages - acknowledge-mode "transacted" #289

Answered by Havret
rizi asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rizi,

It basically means to use transactions for message acknowledgment. It is especially useful when you consume multiple messages, and you want to be sure that they will be acknowledged in all or nothing manner.

Modifying slightly your example, it may look as follows:

await using (IConnection connection = await connectionFactory.CreateAsync(endpoint))
{
    IConsumer consumer = await connection.CreateConsumerAsync("Test", RoutingType.Anycast);
    Message msg1 = await consumer.ReceiveAsync();
    Message msg2 = await consumer.ReceiveAsync();

    // start transaction
    await using (var transaction = new Transaction())
    {
        // ack the first message
        await consumer.A…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Havret
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Havret
Comment options

@yashakapkov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
3 participants
Converted from issue

This discussion was converted from issue #288 on September 06, 2021 20:39.