Examples of asyncPublish()


Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

        assertTrue(queue.take());
        startDelivery(mySubscriber, myTopic, localSubscriberId, new TestMessageHandler(consumeQueue));
        // Publish some messages
        int batchSize = 10;
        for (int i = 0; i < batchSize; i++) {
            myPublisher.asyncPublish(myTopic, getMsg(i), new TestCallback(queue), null);
            assertTrue(queue.take());
            assertTrue(consumeQueue.take());
        }
        // Now manually send a consume message for each message received
        for (int i = 0; i < batchSize; i++) {
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

        // Now start publishing messages for the subscribed topics in one of the
        // regions and verify that it gets delivered and consumed in all of the
        // other ones.
        Publisher publisher = regionClientsMap.values().iterator().next().getPublisher();
        for (int i = 0; i < batchSize; i++) {
            publisher.asyncPublish(ByteString.copyFromUtf8("Topic" + i), Message.newBuilder().setBody(
                                       ByteString.copyFromUtf8("Message" + i)).build(), new TestCallback(queue), null);
            assertTrue(queue.take());
        }
        // Make sure each region consumes the same set of published messages.
        for (int i = 0; i < regionClientsMap.size(); i++) {
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

            public InetSocketAddress getDefaultServerHost() {
                return new InetSocketAddress("localhost", port);
            }
        }).getPublisher();

        publisher.asyncPublish(ByteString.copyFromUtf8("blah"), Message.newBuilder().setBody(
        ByteString.copyFromUtf8("blah")).build(), new Callback<Void>() {
            @Override
            public void operationFailed(Object ctx, PubSubException exception) {
                assertTrue(false);
            }
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

        // Now start publishing messages for the subscribed topics in one of the
        // regions and verify that it gets delivered and consumed in all of the
        // other ones.
        Publisher publisher = regionClientsMap.values().iterator().next().getPublisher();
        for (int i = 0; i < batchSize; i++) {
            publisher.asyncPublish(ByteString.copyFromUtf8("Topic" + i), Message.newBuilder().setBody(
                                       ByteString.copyFromUtf8("Message" + i)).build(), new TestCallback(queue), null);
            assertTrue(queue.take());
        }
        // Make sure each region consumes the same set of published messages.
        for (int i = 0; i < regionClientsMap.size(); i++) {
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

        // other ones.
        int rid = r.nextInt(numRegions);
        String regionName = REGION_PREFIX + rid;
        Publisher publisher = regionClientsMap.get(regionName).getPublisher();
        for (int i = 0; i < batchSize; i++) {
            publisher.asyncPublish(ByteString.copyFromUtf8("Topic" + i), Message.newBuilder().setBody(
                                   ByteString.copyFromUtf8(regionName + "-Message" + i)).build(), new TestCallback(queue), null);
            assertTrue(queue.take());
        }
        // Make sure each region consumes the same set of published messages.
        for (int i = 0; i < regionClientsMap.size(); i++) {
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

        // Now start publishing messages for the subscribed topics in one of the
        // regions and verify that it gets delivered and consumed in all of the
        // other ones.       
        Publisher publisher = client.getPublisher();
        for (int i = 0; i < batchSize; i++) {
            publisher.asyncPublish(ByteString.copyFromUtf8("Topic" + i), Message.newBuilder().setBody(
                                   ByteString.copyFromUtf8(regionName + "-Message" + i)).build(), new TestCallback(queue), null);
            assertTrue(queue.take());
        }
        // Make sure each region consumes the same set of published messages.
        for (int i = 0; i < regionClientsMap.size(); i++) {
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

        assertTrue(queue.take());
        startDelivery(mySubscriber, myTopic, localSubscriberId, new TestMessageHandler(consumeQueue));
        // Publish some messages
        int batchSize = 10;
        for (int i = 0; i < batchSize; i++) {
            myPublisher.asyncPublish(myTopic, getMsg(i), new TestCallback(queue), null);
            assertTrue(queue.take());
            assertTrue(consumeQueue.take());
        }
        // Now manually send a consume message for each message received
        for (int i = 0; i < batchSize; i++) {
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

            public InetSocketAddress getDefaultServerHost() {
                return new InetSocketAddress("localhost", port);
            }
        }).getPublisher();

        publisher.asyncPublish(ByteString.copyFromUtf8("blah"), Message.newBuilder().setBody(
        ByteString.copyFromUtf8("blah")).build(), new Callback<Void>() {
            @Override
            public void operationFailed(Object ctx, PubSubException exception) {
                assertTrue(false);
            }
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

                               new TestCallback(), null);
        assertTrue(queue.take());
        assertTrue(consumeQueue2.take());
        assertTrue(consumeQueue.isEmpty());

        publisher2.asyncPublish(topic, Message.newBuilder().setBody(ByteString.copyFromUtf8("Message #2")).build(),
                               new TestCallback(), null);
        assertTrue(queue.take());
        assertTrue(consumeQueue2.take());
        assertTrue(consumeQueue.isEmpty());
View Full Code Here

Examples of org.apache.hedwig.client.api.Publisher.asyncPublish()

            public InetSocketAddress getDefaultServerHost() {
                return new InetSocketAddress("localhost", port);
            }
        }).getPublisher();

        publisher.asyncPublish(ByteString.copyFromUtf8("blah"), Message.newBuilder().setBody(
        ByteString.copyFromUtf8("blah")).build(), new Callback<Void>() {
            @Override
            public void operationFailed(Object ctx, PubSubException exception) {
                assertTrue(false);
            }
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.