Package org.apache.hedwig.client.api

Examples of org.apache.hedwig.client.api.Subscriber.subscribe()


            final ByteString topic = ByteString.copyFromUtf8("TestSimpleClientTopicBusy");
            final ByteString subid = ByteString.copyFromUtf8("mysub");

            subscriber1.subscribe(topic, subid, CreateOrAttach.CREATE_OR_ATTACH);
            subscriber1.closeSubscription(topic, subid);
            subscriber2.subscribe(topic, subid, CreateOrAttach.ATTACH);
            subscriber2.closeSubscription(topic, subid);

            client1.close();
            client2.close();
        }
View Full Code Here


        final CountDownLatch closeLatch = new CountDownLatch(1);
        final CountDownLatch subLatch = new CountDownLatch(1);
        final CountDownLatch deliverLatch = new CountDownLatch(1);

        try {
            subscriber.subscribe(topic, subid, CreateOrAttach.CREATE_OR_ATTACH);
            sleepDeliveryManager(wakeupLatch);
            subscriber.asyncCloseSubscription(topic, subid, new Callback<Void>() {
                @Override
                public void operationFinished(Object ctx, Void resultOfOperation) {
                    closeLatch.countDown();
View Full Code Here

            final ByteString topic = ByteString.copyFromUtf8("TestSimpleClientTopicBusy");
            final ByteString subid = ByteString.copyFromUtf8("mysub");

            subscriber1.subscribe(topic, subid, CreateOrAttach.CREATE_OR_ATTACH);
            subscriber1.closeSubscription(topic, subid);
            subscriber2.subscribe(topic, subid, CreateOrAttach.ATTACH);
            subscriber2.closeSubscription(topic, subid);

            client1.close();
            client2.close();
        }
View Full Code Here

        Publisher pub = client.getPublisher();
        Subscriber sub = client.getSubscriber();

        ByteString topic = ByteString.copyFromUtf8("basicBoundingTopic");
        ByteString subid = ByteString.copyFromUtf8("basicBoundingSubId");
        sub.subscribe(topic, subid, CreateOrAttach.CREATE);
        sub.closeSubscription(topic, subid);

        sendXExpectLastY(pub, sub, topic, subid, 1000, 5);

        client.close();
View Full Code Here

        ByteString subid5 = ByteString.copyFromUtf8("bound5SubId");
        ByteString subid20 = ByteString.copyFromUtf8("bound20SubId");
        ByteString subidUnbounded = ByteString.copyFromUtf8("noboundSubId");

        sub.subscribe(topic, subid5, options5);
        sub.closeSubscription(topic, subid5);
        sendXExpectLastY(pub, sub, topic, subid5, 1000, 5);

        sub.subscribe(topic, subid20, options20);
        sub.closeSubscription(topic, subid20);
View Full Code Here

        sub.subscribe(topic, subid5, options5);
        sub.closeSubscription(topic, subid5);
        sendXExpectLastY(pub, sub, topic, subid5, 1000, 5);

        sub.subscribe(topic, subid20, options20);
        sub.closeSubscription(topic, subid20);
        sendXExpectLastY(pub, sub, topic, subid20, 1000, 20);

        sub.subscribe(topic, subidUnbounded, optionsUnbounded);
        sub.closeSubscription(topic, subidUnbounded);
View Full Code Here

    public void testSyncHubSubscribeWithInvalidSubscriberId() throws Exception {
        Client hubClient = new HedwigHubClient(new HubClientConfiguration());
        Subscriber hubSubscriber = hubClient.getSubscriber();
        boolean subscribeSuccess = false;
        try {
            hubSubscriber.subscribe(getTopic(0), localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH);
        } catch (InvalidSubscriberIdException e) {
            subscribeSuccess = true;
        } catch (Exception ex) {
            subscribeSuccess = false;
        }
View Full Code Here

    public void testSyncHubSubscribeWithInvalidSubscriberId() throws Exception {
        Client hubClient = new HedwigHubClient(new HubClientConfiguration());
        Subscriber hubSubscriber = hubClient.getSubscriber();
        boolean subscribeSuccess = false;
        try {
            hubSubscriber.subscribe(getTopic(0), localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH);
        } catch (InvalidSubscriberIdException e) {
            subscribeSuccess = true;
        } catch (Exception ex) {
            subscribeSuccess = false;
        }
View Full Code Here

        sub.subscribe(topic, subid20, options20);
        sub.closeSubscription(topic, subid20);
        sendXExpectLastY(pub, sub, topic, subid20, 1000, 20);

        sub.subscribe(topic, subidUnbounded, optionsUnbounded);
        sub.closeSubscription(topic, subidUnbounded);

        sendXExpectLastY(pub, sub, topic, subidUnbounded, 10000, 10000);
        sub.unsubscribe(topic, subidUnbounded);
View Full Code Here

        SubscriptionOptions options10 = SubscriptionOptions.newBuilder()
            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).setMessageBound(10).build();

        ByteString subid = ByteString.copyFromUtf8("updateSubId");

        sub.subscribe(topic, subid, options5);
        sub.closeSubscription(topic, subid);
        sendXExpectLastY(pub, sub, topic, subid, 50, 5);

        // update bound to 20
        sub.subscribe(topic, subid, options20);
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.