Package org.apache.hedwig.client.api

Examples of org.apache.hedwig.client.api.MessageHandler


            fail("Should fail start delivery with filter using null message handler.");
        } catch (NullPointerException npe) {
        }

        try {
            subscriber.startDeliveryWithFilter(topic, subid, new MessageHandler() {
                public void deliver(ByteString topic, ByteString subscriberId,
                                    Message msg, Callback<Void> callback, Object context) {
                    // do nothing
                }
            }, null);
View Full Code Here


        }
        sub.subscribe(topic, subid, CreateOrAttach.ATTACH);

        final AtomicInteger expected = new AtomicInteger(X - Y);
        final CountDownLatch latch = new CountDownLatch(1);
        sub.startDelivery(topic, subid, new MessageHandler () {
                synchronized public void deliver(ByteString topic, ByteString subscriberId,
                                    Message msg, Callback<Void> callback,
                                    Object context) {
                    try {
                        int value = Integer.valueOf(msg.getBody().toStringUtf8());
View Full Code Here

    public void warmup(int nWarmup) throws Exception {
        ByteString topic = ByteString.copyFromUtf8("warmup" + partitionIndex);
        ByteString subId = ByteString.copyFromUtf8("sub");
        subscriber.subscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH);

        subscriber.startDelivery(topic, subId, new MessageHandler() {
            @Override
            public void deliver(ByteString topic, ByteString subscriberId, Message msg, Callback<Void> callback,
            Object context) {
                // noop
                callback.operationFinished(context, null);
View Full Code Here

            }

            final String topic = HedwigBenchmark.TOPIC_PREFIX + i;

            subscriber.subscribe(ByteString.copyFromUtf8(topic), subId, CreateOrAttach.CREATE_OR_ATTACH);
            subscriber.startDelivery(ByteString.copyFromUtf8(topic), subId, new MessageHandler() {

                @Override
                public void deliver(ByteString thisTopic, ByteString subscriberId, Message msg,
                Callback<Void> callback, Object context) {
                    logger.debug("Got message from src-region: {} with seq-id: {}",
View Full Code Here

            logger.error("Client is not yet subscribed to {}.", topicSubscriber);
            throw new ClientNotSubscribedException("Client is not yet subscribed to "
                                                   + topicSubscriber);
        }

        MessageHandler existedMsgHandler = topicSubscriber2MessageHandler.get(topicSubscriber);
        if (restart) {
            // restart using existing msg handler
            messageHandler = existedMsgHandler;
        } else {
            // some has started delivery but not stop it
View Full Code Here

            logger.error("Client is not yet subscribed to {}.", topicSubscriber);
            throw new ClientNotSubscribedException("Client is not yet subscribed to "
                                                   + topicSubscriber);
        }

        MessageHandler existedMsgHandler = topicSubscriber2MessageHandler.get(topicSubscriber);
        if (restart) {
            // restart using existing msg handler
            messageHandler = existedMsgHandler;
        } else {
            // some has started delivery but not stop it
View Full Code Here

            @Override
            public void operationFinished(Object ctx, Void resultOfOperation) {
                if (LOGGER.isDebugEnabled())
                    LOGGER.debug("[" + myRegion.toStringUtf8() + "] cross-region subscription done for topic " + topic.toStringUtf8());
                try {
                    sub.startDelivery(topic, mySubId, new MessageHandler() {
                        @Override
                        public void deliver(final ByteString topic, ByteString subscriberId, Message msg,
                        final Callback<Void> callback, final Object context) {
                            // When messages are first published
                            // locally, the PublishHandler sets the
View Full Code Here

TOP

Related Classes of org.apache.hedwig.client.api.MessageHandler

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.