/**
 * Copyright (C) 2010-2013 Alibaba Group Holding Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.alibaba.rocketmq.example.quickstart;

import com.alibaba.rocketmq.client.exception.MQClientException;
import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import com.alibaba.rocketmq.client.producer.SendResult;
import com.alibaba.rocketmq.common.message.Message;


/**
 * Producer，发送消息
 * 
 */
public class Producer {
    public static void main(String[] args) throws MQClientException, InterruptedException {
        DefaultMQProducer producer = new DefaultMQProducer("please_rename_unique_group_name");
        producer.start();

        for (int i = 0; i < 1000; i++) {
            try {
                Message msg = new Message("TopicTest",// topic
                    "TagA",// tag
                    ("Hello RocketMQ " + i).getBytes()// body
                        );
                SendResult sendResult = producer.send(msg);
                System.out.println(sendResult);
            }
            catch (Exception e) {
                e.printStackTrace();
                Thread.sleep(1000);
            }
        }

        producer.shutdown();
    }
}

@@ -793,16 +793,74 @@
 oducer;%0A
+import com.alibaba.rocketmq.client.producer.SendCallback;%0A
 import c
@@ -907,16 +907,16 @@
 Result;%0A
-
 import c
@@ -1201,16 +1201,59 @@
 name%22);%0A
+        producer.setSendMsgTimeout(10000);%0A
         
@@ -1536,97 +1536,398 @@
     
-SendResult sendResult = producer.send(msg);%0A                System.out.println(sendResult
+ producer.send(msg, new SendCallback() %7B%0A                    @Override%0A                    public void onSuccess(SendResult sendResult) %7B%0A                        System.out.println(sendResult);%0A                    %7D%0A%0A                    @Override%0A                    public void onException(Throwable e) %7B%0A                        e.printStackTrace();%0A                    %7D%0A                %7D
 );%0A 

Test async.