Package com.taobao.metamorphosis.client.consumer

Examples of com.taobao.metamorphosis.client.consumer.MessageIterator


                        + "&group=" + this.config.getGroup() + "&maxsize=" + fetchRequest.getMaxSize();
        final GetMethod httpget = new GetMethod(uri);
        try {
            this.httpclient.executeMethod(httpget);
            if (httpget.getStatusCode() == HttpStatus.Success) {
                return new MessageIterator(fetchRequest.getTopic(), httpget.getResponseBody());
            }
            else if (httpget.getStatusCode() == HttpStatus.NotFound) {
                return null;
            }
            else {
View Full Code Here


    @Test
    public void testSyncConsume() throws MetaClientException, InterruptedException {
        final SimpleHttpConsumer client = new SimpleHttpConsumer(new HttpClientConfig("localhost", 8080));

        MessageIterator it = null;
        // get messages
        long syncOffSet = this.offset;
        while ((it = client.get("meta-test", new Partition(1, 1), syncOffSet, 99999)) != null) {
            while (it.hasNext()) {
                final Message msg = it.next();
                logger.info("Receive message:" + new String(msg.getData()));
                logger.info("message attribute:" + msg.getAttribute());
            }

            syncOffSet += it.getOffset();
        }

    }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.client.consumer.MessageIterator

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.