Package com.taobao.metamorphosis.client.consumer

Examples of com.taobao.metamorphosis.client.consumer.MessageConsumer.subscribe()


        // consumer group
        final String group = "meta-example";
        // create consumer,ǿ�ҽ���ʹ�õ���
        final MessageConsumer consumer = sessionFactory.createBroadcastConsumer(new ConsumerConfig(group));
        // subscribe topic
        consumer.subscribe(topic, 1024 * 1024, new MessageListener() {

            @Override
            public void recieveMessages(final Message message) {
                System.out.println("Receive message " + new String(message.getData()));
            }
View Full Code Here


        // consumer group
        final String group = "meta-example";
        // create consumer,ǿ�ҽ���ʹ�õ���
        final MessageConsumer consumer = sessionFactory.createConsumer(new ConsumerConfig(group));
        // subscribe topic
        consumer.subscribe(topic, 1024 * 1024, new MessageListener() {

            private int count = 0;


            @Override
View Full Code Here

        ConsumerConfig consumerConfig = new ConsumerConfig(group);
        // Ĭ������ȡ�ӳ�Ϊ5�룬�������ó�100���룬�����ʵ��Ӧ��Ҫ�������á�
        consumerConfig.setMaxDelayFetchTimeInMills(100);
        final MessageConsumer consumer = sessionFactory.createConsumer(consumerConfig);
        // subscribe topic
        consumer.subscribe(topic, 1024 * 1024, new MessageListener() {

            @Override
            public void recieveMessages(final Message message) {
                System.out.println("Receive message " + new String(message.getData()));
            }
View Full Code Here

    MetaMessageSessionFactory factory = new MetaMessageSessionFactory(config);
    String topic = "test";
    String group = "pingwei";
    ConsumerConfig consumerConfig = new ConsumerConfig(group);
    MessageConsumer consumer = factory.createConsumer(consumerConfig);
    consumer.subscribe(topic, 1024*1024, new MessageListener() {
     
      public void recieveMessages(Message message) {
        System.out.println("receive message " + new String(message.getData()));
      }
     
View Full Code Here

        ConsumerConfig consumerConfig = new ConsumerConfig(group);
        // Ĭ������ȡ�ӳ�Ϊ5�룬�������ó�100���룬�����ʵ��Ӧ��Ҫ�������á�
        consumerConfig.setMaxDelayFetchTimeInMills(100);
        final MessageConsumer consumer = sessionFactory.createConsumer(consumerConfig);
        // subscribe topic
        consumer.subscribe(topic, 1024 * 1024, new MessageListener() {

            @Override
            public void recieveMessages(final Message message) {
                System.out.println("Receive message " + new String(message.getData()));
            }
View Full Code Here

                }
                log.info("Subscribe topic=" + topic.getTopic() + " with group=" + topic.getGroup());
                if (listener.getMessageBodyConverter() == null) {
                    listener.setMessageBodyConverter(this.messageBodyConverter);
                }
                consumer.subscribe(topic.getTopic(), topic.getMaxBufferSize(), listener);
                consumers.add(consumer);
            }
            for (MessageConsumer consumer : consumers) {
                consumer.completeSubscribe();
            }
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.