You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by thisisbaozi <gi...@git.apache.org> on 2017/01/01 03:02:39 UTC

[GitHub] incubator-rocketmq pull request #24: add new way to send messages in asynchr...

GitHub user thisisbaozi opened a pull request:

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

    add new way to send messages in asynchronous way

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

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/thisisbaozi/incubator-rocketmq master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-rocketmq/pull/24.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #24
    
----
commit 67545d976c608211eeb07feca0b9e39b5f04c2b1
Author: thisisbaozi <th...@gmail.com>
Date:   2017-01-01T02:52:47Z

    add new way to send message in asynchronous way

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rocketmq pull request #24: add new way to send messages in asynchr...

Posted by thisisbaozi <gi...@git.apache.org>.
Github user thisisbaozi closed the pull request at:

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---