Package com.aliyun.openservices.ons.api

Examples of com.aliyun.openservices.ons.api.Producer.send()


        Message msg = new Message(//
            "TopicTestONS", // Topic, 请向ONS运维人员申请
            "TagA", // Tag, 相当于子Topic概念,应用可以自由设置,Consumer消费时,可以通过他来过滤消息
            "Hello ONS".getBytes()// 消息内容,二进制形式
                );
        SendResult sendResult = producer.send(msg);
        System.out.println(sendResult);
        producer.shutdown();
       
       
View Full Code Here


        // 以方便您在无法正常收到消息情况下,可通过ONS Console查询消息并补发。
        // 注意:不设置也不会影响消息正常收发
        msg.setKey("ORDERID_100");

        // 发送消息,只要不抛异常就是成功
        SendResult sendResult = producer.send(msg);
        System.out.println(sendResult);

        // 在应用退出前,销毁Producer对象<br>
        // 注意:如果不销毁也没有问题
        producer.shutdown();
View Full Code Here

        Message msg = new Message(//
            "TopicTestONS", // Topic, 请向ONS运维人员申请
            "TagA", // Tag, 相当于子Topic概念,应用可以自由设置,Consumer消费时,可以通过他来过滤消息
            "Hello ONS".getBytes()// 消息内容,二进制形式
                );
        SendResult sendResult = producer.send(msg);
        System.out.println(sendResult);
        producer.shutdown();
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.