question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot publish messages when publisherConfirms=true and timeout=0

See original GitHub issue

Subject of the issue

When I set publisherConfirms=true and timeout=0 (to have infinite timeout) at the same time in connectionString, I cannot publish (any kind of publish) messages. Subscribing messages with the same connectionString is okay though. I checked RabbitMQ management and see no message is published at all.

Your environment

  • .Net Core 3.1
  • EasyNetQ 3.7.1
  • RabbitMQ 3.8.2

Steps to reproduce

Define a connectionString with ;publisherConfirms=true;timeout=0 properties and cannot publish messages.

This is the whole program to reproduce the issue

class Program
{
    static void Main(string[] args)
    {            
        var bus = RabbitHutch.CreateBus(
                        "host=localhost;username=guest;password=guest;publisherConfirms=true;timeout=0");

        // cannot publish message when publisherConfirms=true;timeout=0 both together

        bus.Subscribe<XMessage>(
            "freaking_subscriptionId",
                message => Console.WriteLine($"message received \"{message.Text}\"")
        );

        bus.Publish(new XMessage {Text = "something"});
        
        Console.WriteLine("press any key to exit");
        Console.ReadKey();
        bus.Dispose();
    }

    private class XMessage
    {
        public string Text {get;set;}
    }
}

Expected behaviour

the message is published and “message received” is logged in the console.

Actual behaviour

no message is published.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Plinercommented, May 3, 2020

Resolved by #1049.

@mortzi Many thanks for this issue 😉

2reactions
Plinercommented, Apr 22, 2020

Hi @mortzi.

Thanks for the report.

From implementation point of view I could confirm that there are two bugs:

  1. The case of zero timeout library shows a very sad bug when in some rare cases EasyNetQ could report that a message was sent, but it wasn’t. So we need to fix it.
  2. We need to handle zero timeout as infinite 😃
Read more comments on GitHub >

github_iconTop Results From Across the Web

Publishing messages burst timeout · Issue #1462
Unable to publish for key "....". Reason: Total timeout of API google.pubsub.v1.Publisher exceeded 60000 milliseconds before any response was ...
Read more >
Spring integration - Publisher Confirms with timeout?
My guess is that somehow publish of message is waiting for rabbit to do PUBLISHER CONFIRMS but it never gets it and times...
Read more >
Issue with timeouts publishing to RabbitMQ
We have written an application that publishes to rabbit using the headers exchange for routing to queues (approximately 1800 queues ...
Read more >
Reliable Publishing with Publisher Confirms
Strategy #1: Publishing Messages Individually​​ The method returns as soon as the message has been confirmed. If the message is not confirmed within...
Read more >
Spring AMQP
Publishing messages is an asynchronous mechanism and, by default, messages that cannot be routed are dropped by RabbitMQ. For successful publishing, you can ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found