Package org.apache.hedwig.client.data

Examples of org.apache.hedwig.client.data.TopicSubscriber


                                        ClientMessageFilter messageFilter)
            throws ClientNotSubscribedException, AlreadyStartDeliveryException {
        if (null == messageHandler || null == messageFilter) {
            throw new NullPointerException("Null message handler or message filter is       provided.");
        }
        TopicSubscriber topicSubscriber = new TopicSubscriber(topic, subscriberId);
        messageHandler = new FilterableMessageHandler(messageHandler, messageFilter);
        logger.debug("Starting delivery with filter for {}.", topicSubscriber);
        channelManager.startDelivery(topicSubscriber, messageHandler);
    }
View Full Code Here


        channelManager.startDelivery(topicSubscriber, messageHandler);
    }

    public void stopDelivery(final ByteString topic, final ByteString subscriberId)
    throws ClientNotSubscribedException {
        TopicSubscriber topicSubscriber = new TopicSubscriber(topic, subscriberId);
        logger.debug("Stopping delivery for {}.", topicSubscriber);
        channelManager.stopDelivery(topicSubscriber);
    }
View Full Code Here

                                 new VoidCallbackAdapter<ResponseBody>(callback), context);
    }

    private void doAsyncCloseSubscription(final ByteString topic, final ByteString subscriberId,
                                          final Callback<ResponseBody> callback, final Object context) {
        TopicSubscriber topicSubscriber = new TopicSubscriber(topic, subscriberId);
        logger.debug("Stopping delivery for {} before closing subscription.", topicSubscriber);
        // We only stop delivery here not in channel manager
        // Because channelManager#asyncCloseSubscription will called
        // when subscription channel disconnected to clear local subscription
        try {
View Full Code Here

        HChannel hChannel;
        if (OperationType.PUBLISH.equals(pubSubData.operationType) ||
            OperationType.UNSUBSCRIBE.equals(pubSubData.operationType)) {
            hChannel = getNonSubscriptionChannelByTopic(pubSubData.topic);
        } else {
            TopicSubscriber ts = new TopicSubscriber(pubSubData.topic,
                                                     pubSubData.subscriberId);
            hChannel = getSubscriptionChannelByTopicSubscriber(ts);
        }
        // no channel found to submit pubsub data
        // choose the default server
View Full Code Here

            logger.debug("Handling a Subscribe response: {}, pubSubData: {}, host: {}.",
                         va(response, pubSubData, NetUtils.getHostFromChannel(channel)));
        }
        switch (response.getStatusCode()) {
        case SUCCESS:
            TopicSubscriber ts = new TopicSubscriber(pubSubData.topic,
                                                     pubSubData.subscriberId);
            SubscriptionPreferences preferences = null;
            if (response.hasResponseBody()) {
                ResponseBody respBody = response.getResponseBody();
                if (respBody.hasSubscribeResponse()) {
View Full Code Here

    }

    @Override
    public void handleSubscribeMessage(PubSubResponse response) {
        Message message = response.getMessage();
        TopicSubscriber ts = new TopicSubscriber(response.getTopic(),
                                                 response.getSubscriberId());
        if (logger.isDebugEnabled()) {
            logger.debug("Handling a Subscribe message in response: {}, {}",
                         va(response, ts));
        }
View Full Code Here

    }

    @Override
    public void handleSubscriptionEvent(ByteString topic, ByteString subscriberId,
                                        SubscriptionEvent event) {
        TopicSubscriber ts = new TopicSubscriber(topic, subscriberId);
        ActiveSubscriber ss = getActiveSubscriber(ts);
        if (null == ss) {
            logger.warn("No subscription {} found receiving subscription event {}.",
                        va(ts, event));
            return;
View Full Code Here

        enqueueWithoutFailure(subscriber);
    }

    public void stopServingSubscriber(ByteString topic, ByteString subscriberId) {
        ActiveSubscriberState subState = subscriberStates.get(new TopicSubscriber(topic, subscriberId));

        if (subState != null) {
            stopServingSubscriber(subState);
        }
    }
View Full Code Here

         * {@link DeliveryManagerRequest} methods
         */
        public void performRequest() {

            // Put this subscriber in the channel to subscriber mapping
            ActiveSubscriberState prevSubscriber = subscriberStates.put(new TopicSubscriber(topic, subscriberId), this);

            if (prevSubscriber != null) {
                stopServingSubscriber(prevSubscriber);
            }

View Full Code Here

    public void channelDisconnected(Channel channel) {
        // Evils of synchronized programming: there is a race between a channel
        // getting disconnected, and us adding it to the maps when a subscribe
        // succeeds
        synchronized (channel) {
            TopicSubscriber topicSub = channel2sub.remove(channel);
            if (topicSub != null) {
                sub2Channel.remove(topicSub);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.hedwig.client.data.TopicSubscriber

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.