Package org.apache.hedwig.filter

Examples of org.apache.hedwig.filter.PipelineFilter


                        subStats.incrementFailedOps();
                        return;
                    }
                }
                // initialize the message filter
                PipelineFilter filter = new PipelineFilter();
                try {
                    // the filter pipeline should be
                    // 1) AllToAllTopologyFilter to filter cross-region messages
                    filter.addLast(new AllToAllTopologyFilter());
                    // 2) User-Customized MessageFilter
                    if (subData.hasPreferences() &&
                        subData.getPreferences().hasMessageFilter()) {
                        String messageFilterName = subData.getPreferences().getMessageFilter();
                        filter.addLast(ReflectionUtils.newInstance(messageFilterName, ServerMessageFilter.class));
                    }
                    // initialize the filter
                    filter.initialize(cfg.getConf());
                    filter.setSubscriptionPreferences(topic, subscriberId,
                                                      subData.getPreferences());
                } catch (RuntimeException re) {
                    String errMsg = "RuntimeException caught when instantiating message filter for (topic:"
                                  + topic.toStringUtf8() + ", subscriber:" + subscriberId.toStringUtf8() + ")."
                                  + "It might be introduced by programming error in message filter.";
View Full Code Here


        // make sure delivery was started
        StartServingRequest startRequest = (StartServingRequest) dm.lastRequest.poll();
        assertEquals(channel, ((ChannelEndPoint) startRequest.endPoint).getChannel());
        assertEquals(PipelineFilter.class, startRequest.filter.getClass());
        PipelineFilter pfilter = (PipelineFilter)(startRequest.filter);
        assertEquals(1, pfilter.size());
        assertEquals(AllToAllTopologyFilter.class, pfilter.getFirst().getClass());
        assertEquals(1, startRequest.seqIdToStartFrom.getLocalComponent());
        assertEquals(subscriberId, startRequest.subscriberId);
        assertEquals(topic, startRequest.topic);

        // make sure subscription was registered
View Full Code Here

        PersistenceManager pm = new StubPersistenceManager();
        FIFODeliveryManager fdm = new FIFODeliveryManager(pm, conf);
        ExecutorDeliveryEndPointWithQueue dep = new ExecutorDeliveryEndPointWithQueue();
        SubscriptionPreferences prefs = SubscriptionPreferences.newBuilder().build();

        PipelineFilter filter = new PipelineFilter();
        filter.addLast(new AllToAllTopologyFilter());
        filter.initialize(conf.getConf());
        filter.setSubscriptionPreferences(topic, subscriber, prefs);
        MessageSeqId startId = MessageSeqId.newBuilder().setLocalComponent(1).build();

        CountDownLatch l = new CountDownLatch(1);
        Message m = Message.newBuilder().setBody(ByteString.copyFromUtf8(String.valueOf(1))).build();
        TestCallback cb = new TestCallback(l);
View Full Code Here

        PersistenceManager pm = new StubPersistenceManager();
        FIFODeliveryManager fdm = new FIFODeliveryManager(pm, conf);
        ExecutorDeliveryEndPoint dep = new ExecutorDeliveryEndPoint(fdm);
        SubscriptionPreferences prefs = SubscriptionPreferences.newBuilder().build();

        PipelineFilter filter = new PipelineFilter();
        filter.addLast(new AllToAllTopologyFilter());
        filter.initialize(conf.getConf());
        filter.setSubscriptionPreferences(topic, subscriber, prefs);

        CountDownLatch l = new CountDownLatch(numMessages);

        TestCallback firstCallback = null;
        for (int i = 0; i < numMessages; i++) {
View Full Code Here

TOP

Related Classes of org.apache.hedwig.filter.PipelineFilter

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.