Package com.taobao.metamorphosis.client

Examples of com.taobao.metamorphosis.client.TopicBrowser


public class TopicBrowserExample {
    public static void main(final String[] args) throws Exception {
        // New session factory,ǿ�ҽ���ʹ�õ���
        final MessageSessionFactory sessionFactory = new MetaMessageSessionFactory(initMetaConfig());
        final String topic = "meta-test";
        final TopicBrowser browser = sessionFactory.createTopicBrowser(topic);

        Iterator<Message> it = browser.iterator();
        while (it.hasNext()) {
            Message msg = it.next();
            System.out.println("message body:" + new String(msg.getData()));
        }

        browser.shutdown();
        sessionFactory.shutdown();
    }
View Full Code Here


        finally {
            this.producer.shutdown();
            this.consumer.shutdown();
        }

        TopicBrowser topicBrowser = this.sessionFactory.createTopicBrowser(this.topic);
        try {
            Iterator<Message> it = topicBrowser.iterator();
            int n = 0;
            while (it.hasNext()) {
                assertNotNull(it.next());
                n++;
            }
            assertEquals(100, n);
        }
        finally {
            topicBrowser.shutdown();
        }
    }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.client.TopicBrowser

Copyright © 2018 www.massapicom. 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.