You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/01 04:02:58 UTC

[jira] [Commented] (ROCKETMQ-26) add a new way to send message in async

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

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

Github user thisisbaozi closed the pull request at:

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


> 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)