Skip to content

[ROCKETMQ-26]add new way to send messages in asynchronous way#25

Closed
thisisbaozi wants to merge 3 commits into
apache:masterfrom
thisisbaozi:master
Closed

[ROCKETMQ-26]add new way to send messages in asynchronous way#25
thisisbaozi wants to merge 3 commits into
apache:masterfrom
thisisbaozi:master

Conversation

@thisisbaozi

@thisisbaozi thisisbaozi commented Jan 1, 2017

Copy link
Copy Markdown

an new way to send message in async way, it looks like:

MQProducer producer = ...;
ExecutorService sharedExecutorService = ...
SendFuture future = producer.send(msg, sharedExecutorService, timeout);
future.addCallback(new SendCallback() {
            @Override
            public void onSuccess(SendResult sendResult) {
                  // do sth 
            }

            @Override
            public void onException(Throwable e) {
                   // do sth
            }
});

There are three advantages for this way:

Executes the callback logic in exclusive thread pool
Multiple callbacks are allowed
Gets the result of sending in synchronous API(get/get(time, unit))

Jira issue: https://issues.apache.org/jira/browse/ROCKETMQ-26

@thisisbaozi thisisbaozi changed the title add new way to send messages in asynchronous way [ROCKETMQ-26]add new way to send messages in asynchronous way Jan 1, 2017
@thisisbaozi thisisbaozi closed this Jan 1, 2017
lizhanhui pushed a commit to lizhanhui/rocketmq that referenced this pull request Jun 25, 2019
pingww pushed a commit that referenced this pull request Aug 26, 2022
* fix '#' check in topicFilter

link #19

* remove email & author info

* Add licence header to file.

Co-authored-by: wangfan <wangfan8@xiaomi.com>
Co-authored-by: dinglei <libya_003@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant