Package com.netflix.suro.sink

Examples of com.netflix.suro.sink.SinkManager


                    binder.bindConfigurationProvider().toInstance(new PropertiesConfigurationProvider(properties));
                }
        }).build().createInjector();
       
       
        SinkManager sinkManager = startSinkMakager(injector);

        startMessageRouter(injector);

        MessageSetProcessor queue = injector.getInstance(MessageSetProcessor.class);
        queue.setInput(mock(SuroInput.class));
        queue.start();

        MessageSetBuilder builder = new MessageSetBuilder(new ClientConfig());

        for (int i = 0; i < 10; ++i) {
            builder.withMessage("topic1", Integer.toString(i).getBytes());
        }
        // sink1: 10
        // default: 10
        queue.process(builder.build());

        for (int i = 0; i < 5; ++i) {
            builder.withMessage("topic2", Integer.toString(i).getBytes());
        }
        // sink1: 5
        queue.process(builder.build());

        for (int i = 0; i < 15; ++i) {
            builder.withMessage("topic3", Integer.toString(i).getBytes());
        }
        queue.process(builder.build());
        // sink3: 15 with topic3_alias

        for (int i = 0; i < 20; ++i) {
            builder.withMessage("topic4", Integer.toString(i).getBytes());
        }
        // default: 20
        queue.process(builder.build());

        // total sink1: 15, default: 30
        int count = 10;
        while (!answer() && count > 0) {
            Thread.sleep(1000);
            --count;
        }
        assertTrue(count > 0);

        queue.shutdown();
        sinkManager.shutdown();
    }
View Full Code Here


                "    \"sink3\": {\n" +
                "        \"type\": \"TestSink\",\n" +
                "        \"message\": \"sink3\"\n" +
                "    }\n" +
                "}";
        SinkManager sinkManager = injector.getInstance(SinkManager.class);
        ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
        sinkManager.set(getSinkMap(mapper, sinkDesc));

        return sinkManager;
    }
View Full Code Here

        RoutingMap map = new RoutingMap();
        map.set(new ImmutableMap.Builder<String, RoutingMap.RoutingInfo>()
                .put(TOPIC_NAME, new RoutingMap.RoutingInfo(Lists.newArrayList(new RoutingMap.Route("es", null, null)), null))
                .build());

        SinkManager sinks = new SinkManager();
        sinks.initialSet(new ImmutableMap.Builder<String, Sink>()
                .put("es", sink).build());

        MessageRouter router = new MessageRouter(map, sinks, jsonMapper);

        Properties properties = new Properties();
View Full Code Here

                true,
                spaceChecker
        );
        sink.open();

        SinkManager sinks = new SinkManager();
        sinks.initialSet(new ImmutableMap.Builder<String, Sink>()
                .put("local", sink).build());

        RoutingMap map = new RoutingMap();
        map.set(new ImmutableMap.Builder<String, RoutingMap.RoutingInfo>()
                .put(TOPIC_NAME, new RoutingMap.RoutingInfo(Lists.newArrayList(new RoutingMap.Route("local", null, null)), null))
View Full Code Here

TOP

Related Classes of com.netflix.suro.sink.SinkManager

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.