Package com.aliyun.openservices.ons.api

Examples of com.aliyun.openservices.ons.api.Consumer.subscribe()


        Properties properties = new Properties();
        properties.put(PropertyKeyConst.ConsumerId, "ConsumerId1");
        properties.put(PropertyKeyConst.MessageModel, PropertyValueConst.BROADCASTING);
        Consumer consumer = ONSFactory.createConsumer(properties);

        consumer.subscribe("TopicTestONS", "*", new MessageListener() {

            @Override
            public Action consume(Message message, ConsumeContext context) {
                System.out.println(message);
                return Action.CommitMessage;
View Full Code Here


        Properties properties = new Properties();
        properties.put(PropertyKeyConst.ConsumerId, "CID_001");
        properties.put(PropertyKeyConst.AccessKey, "F0000043D88CB7EF4");
        properties.put(PropertyKeyConst.SecretKey, "F0000043D900F191F");
        Consumer consumer = ONSFactory.createConsumer(properties);
        consumer.subscribe("TopicTestONS", "*", new MessageListener() {

            public Action consume(Message message, ConsumeContext context) {
                System.out.println("Receive: " + message);
                return Action.CommitMessage;
            }
View Full Code Here

        Properties properties = new Properties();
        properties.put(PropertyKeyConst.ConsumerId, "ConsumerId1");
        properties.put(PropertyKeyConst.MessageModel, PropertyValueConst.Broadcasting);
        Consumer consumer = ONSFactory.createConsumer(properties);

        consumer.subscribe("TopicTestONS", "*", new MessageListener() {

            @Override
            public Action consume(Message message, ConsumeContext context) {
                System.out.println(message);
                return Action.CommitMessage;
View Full Code Here

    public static void main(String[] args) {
        Properties properties = new Properties();
        // ProducerId,代表一类Consumer,请向ONS运维人员申请
        properties.put(PropertyKeyConst.ConsumerId, "jiangjinrong");
        Consumer consumer = ONSFactory.createConsumer(properties);
        consumer.subscribe("TopicTestONS", "*", new MessageListener() {

            @Override
            public Action consume(Message message, ConsumeContext context) {
                System.out.println("Receive: " + message);
                return Action.CommitMessage;
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.