[ 
https://issues.apache.org/jira/browse/ROCKETMQ-26?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15831076#comment-15831076
 ] 

ASF GitHub Bot commented on ROCKETMQ-26:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-rocketmq/pull/26


> add a new way to send message in async
> --------------------------------------
>
>                 Key: ROCKETMQ-26
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-26
>             Project: Apache RocketMQ
>          Issue Type: New Feature
>            Reporter: stone
>            Assignee: vongosling
>
> 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:
> 0. Executes the callback logic in exclusive thread pool
> 1. Multiple callbacks are allowed
> 2. Gets the result of sending in synchronous API(get/get(time, unit))



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to