GitHub user ragaur-tibco added a comment to the discussion: async/sync mode in 
pulsar producer and consumer

@lhotari In Apache Pulsar, does async and sync mode work and how can I verify 
that the mode selected is working? 

There are multiple APIs used by the producer to send messages.

1. send()

2. sendAsync()

While internally, TypedMessageBuilderImpl.class present in **package 
org.apache.pulsar.client.impl**  send() method is calling sendAsync() 

```
    public MessageId send() throws PulsarClientException {
        try {
            // enqueue the message to the buffer
            CompletableFuture<MessageId> sendFuture = sendAsync();

            if (!sendFuture.isDone()) {
                // the send request wasn't completed yet (e.g. not failing at 
enqueuing), then attempt to triggerFlush
                // it out
                producer.triggerFlush();
            }

            return sendFuture.get();
        } catch (Exception e) {
            throw PulsarClientException.unwrap(e);
        }
    }  
```


GitHub link: 
https://github.com/apache/pulsar/discussions/22382#discussioncomment-8980638

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to