Package org.apache.hedwig.protocol.PubSubProtocol

Examples of org.apache.hedwig.protocol.PubSubProtocol.PubSubRequest


        channel = new WriteRecordingChannel();
        ush.handleRequestAtOwner(pubSubRequestPrototype, channel);
        assertEquals(StatusCode.MALFORMED_REQUEST, ((PubSubResponse) channel.getMessagesWritten().get(0))
                     .getStatusCode());

        PubSubRequest unsubRequest = PubSubRequest.newBuilder(pubSubRequestPrototype).setUnsubscribeRequest(
                                         UnsubscribeRequest.newBuilder().setSubscriberId(subscriberId)).build();
        channel = new WriteRecordingChannel();
        dm.lastRequest.clear();

        ush.handleRequestAtOwner(unsubRequest, channel);
View Full Code Here


    protected void startDelivery(Subscriber subscriber, ByteString topic, ByteString subscriberId,
                                 MessageHandler handler) throws Exception {
        subscriber.startDelivery(topic, subscriberId, handler);
        if (mode == Mode.PROXY) {
            WriteRecordingChannel channel = new WriteRecordingChannel();
            PubSubRequest request = PubSubRequest.newBuilder().setProtocolVersion(ProtocolVersion.VERSION_ONE)
                                    .setTopic(topic).setTxnId(0).setType(OperationType.START_DELIVERY).setStartDeliveryRequest(
                                        StartDeliveryRequest.newBuilder().setSubscriberId(subscriberId)).build();
            proxy.getStartDeliveryHandler().handleRequest(request, channel);
            assertEquals(StatusCode.SUCCESS, ((PubSubResponse) channel.getMessagesWritten().get(0)).getStatusCode());
        }
View Full Code Here

    protected void startDelivery(Subscriber subscriber, ByteString topic, ByteString subscriberId,
                                 MessageHandler handler) throws Exception {
        subscriber.startDelivery(topic, subscriberId, handler);
        if (mode == Mode.PROXY) {
            WriteRecordingChannel channel = new WriteRecordingChannel();
            PubSubRequest request = PubSubRequest.newBuilder().setProtocolVersion(ProtocolVersion.VERSION_ONE)
                                    .setTopic(topic).setTxnId(0).setType(OperationType.START_DELIVERY).setStartDeliveryRequest(
                                        StartDeliveryRequest.newBuilder().setSubscriberId(subscriberId)).build();
            proxy.getStartDeliveryHandler().handleRequest(request, channel);
            assertEquals(StatusCode.SUCCESS, ((PubSubResponse) channel.getMessagesWritten().get(0)).getStatusCode());
        }
View Full Code Here

    }

    protected void stopDelivery(Subscriber subscriber, ByteString topic, ByteString subscriberId) throws Exception {
        subscriber.stopDelivery(topic, subscriberId);
        if (mode == Mode.PROXY) {
            PubSubRequest request = PubSubRequest.newBuilder().setProtocolVersion(ProtocolVersion.VERSION_ONE)
                                    .setTopic(topic).setTxnId(1).setType(OperationType.STOP_DELIVERY).setStopDeliveryRequest(
                                        StopDeliveryRequest.newBuilder().setSubscriberId(subscriberId)).build();
            proxy.getStopDeliveryHandler().handleRequest(request, proxy.getChannelTracker().getChannel(topic, subscriberId));
        }
    }
View Full Code Here

        channel = new WriteRecordingChannel();
        ush.handleRequestAtOwner(pubSubRequestPrototype, channel);
        assertEquals(StatusCode.MALFORMED_REQUEST, ((PubSubResponse) channel.getMessagesWritten().get(0))
                     .getStatusCode());

        PubSubRequest unsubRequest = PubSubRequest.newBuilder(pubSubRequestPrototype).setUnsubscribeRequest(
                                         UnsubscribeRequest.newBuilder().setSubscriberId(subscriberId)).build();
        channel = new WriteRecordingChannel();
        dm.lastRequest.clear();

        ush.handleRequestAtOwner(unsubRequest, channel);
View Full Code Here

    protected void startDelivery(Subscriber subscriber, ByteString topic, ByteString subscriberId,
                                 MessageHandler handler) throws Exception {
        subscriber.startDelivery(topic, subscriberId, handler);
        if (mode == Mode.PROXY) {
            WriteRecordingChannel channel = new WriteRecordingChannel();
            PubSubRequest request = PubSubRequest.newBuilder().setProtocolVersion(ProtocolVersion.VERSION_ONE)
                                    .setTopic(topic).setTxnId(0).setType(OperationType.START_DELIVERY).setStartDeliveryRequest(
                                        StartDeliveryRequest.newBuilder().setSubscriberId(subscriberId)).build();
            proxy.getStartDeliveryHandler().handleRequest(request, channel);
            assertEquals(StatusCode.SUCCESS, ((PubSubResponse) channel.getMessagesWritten().get(0)).getStatusCode());
        }
View Full Code Here

    }

    protected void stopDelivery(Subscriber subscriber, ByteString topic, ByteString subscriberId) throws Exception {
        subscriber.stopDelivery(topic, subscriberId);
        if (mode == Mode.PROXY) {
            PubSubRequest request = PubSubRequest.newBuilder().setProtocolVersion(ProtocolVersion.VERSION_ONE)
                                    .setTopic(topic).setTxnId(1).setType(OperationType.STOP_DELIVERY).setStopDeliveryRequest(
                                        StopDeliveryRequest.newBuilder().setSubscriberId(subscriberId)).build();
            proxy.getStopDeliveryHandler().handleRequest(request, proxy.getChannelTracker().getChannel(topic, subscriberId));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.hedwig.protocol.PubSubProtocol.PubSubRequest

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.