I agree and considering that send(..) method returns Future one would argue it must never block, otherwise what’s the point of returning Future if you remove user’s ability to control how long are they willing to wait and what to do when certain types of exception arise. Nevertheless it does and it happens in the very first line of code: // first make sure the metadata for the topic is available waitOnMetadata(record.topic(), this.metadataFetchTimeoutMs); So I am curious as well as to what is the motivation for it as we’ve seen the same symptoms multiple times. Cheers Oleg On Mar 29, 2016, at 4:31 AM, Paolo Patierno <ppatie...@live.com<mailto:ppatie...@live.com>> wrote:
Hello, as documentation says, the KafkaProducer.send() method is asynchronous and it just returns immediately.I found out that it's not so true when the Kafka server it's trying to connect isn't online.Of course it happens only on the first send() method invocation. It means that if the Kafka server isn't reachable when my application starts for the first time, the send() method isn't so asynchronous but it blocks.I know that it's trying to connect to the Kafka server but why it doesn't save the message into the buffer and returns immediately ?Is it a behavior or a bug ? Thanks,Paolo Paolo PatiernoSenior Software Engineer Windows Embedded & IoTMicrosoft Azure Advisor Twitter : @ppatierno Linkedin : paolopatierno Blog : DevExperienceBlog : Embedded101