Package com.aliyun.openservices.ons.api

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


        Properties properties = new Properties();
        // ProducerId,代表一类Producer,请向MetaQ运维人员申请
        properties.put(PropertyKeyConst.ProducerId, "ProducerId1");
        properties.put(PropertyKeyConst.ProducerId, "ProducerId1");
        Producer producer = ONSFactory.createProducer(properties);
        producer.start();
        Message msg = new Message(//
            "TopicTestONS", // Topic, 请向ONS运维人员申请
            "TagA", // Tag, 相当于子Topic概念,应用可以自由设置,Consumer消费时,可以通过他来过滤消息
            "Hello ONS".getBytes()// 消息内容,二进制形式
                );
View Full Code Here


        properties.put(PropertyKeyConst.ProducerId, "PID_001");
        properties.put(PropertyKeyConst.AccessKey, "F0000043D88CB7EF4");
        properties.put(PropertyKeyConst.SecretKey, "F0000043D900F191F");
        Producer producer = ONSFactory.createProducer(properties);
        // 在发送消息前,必须调用start方法来启动Producer,只需调用一次即可。
        producer.start();
        Message msg = new Message( //
            // Message Topic
            "TopicTestONS",
            // Message Tag,
            // 可理解为Gmail中的标签,对消息进行再归类,方便Consumer指定过滤条件在ONS服务器过滤
View Full Code Here

    public static void main(String[] args) {
        Properties properties = new Properties();
        // ProducerId,代表一类Producer,请向MetaQ运维人员申请
        properties.put(PropertyKeyConst.ProducerId, "ProducerId1");
        Producer producer = ONSFactory.createProducer(properties);
        producer.start();
        Message msg = new Message(//
            "TopicTestONS", // Topic, 请向ONS运维人员申请
            "TagA", // Tag, 相当于子Topic概念,应用可以自由设置,Consumer消费时,可以通过他来过滤消息
            "Hello ONS".getBytes()// 消息内容,二进制形式
                );
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.