Java Code Examples for org.apache.flume.Sink#stop()
The following examples show how to use
org.apache.flume.Sink#stop() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSinkProcessor.java From mt-flume with Apache License 2.0 | 5 votes |
@Override public void stop() { for(Sink s : sinkList) { //s.start(); s.stop(); //modify by judasheng, FLUME-1718 } state = LifecycleState.STOP; }
Example 2
Source File: TwitterSourceTest.java From fiware-cygnus with GNU Affero General Public License v3.0 | 4 votes |
@Test public void testBasic() throws Exception { System.out.println(getTestTraceHead("[TwitterSourceTest.basic]") + "-------- Start source."); Context context = new Context(); context.put("consumerKey", consumerKey); context.put("consumerSecret", consumerSecret); context.put("accessToken", accessToken); context.put("accessTokenSecret", accessTokenSecret); context.put("maxBatchDurationMillis", "1000"); TwitterSource source = new TwitterSource(); source.configure(context); Map<String, String> channelContext = new HashMap(); channelContext.put("capacity", "1000000"); channelContext.put("keep-alive", "0"); // for faster tests Channel channel = new MemoryChannel(); Configurables.configure(channel, new Context(channelContext)); Sink sink = new LoggerSink(); sink.setChannel(channel); sink.start(); DefaultSinkProcessor proc = new DefaultSinkProcessor(); proc.setSinks(Collections.singletonList(sink)); SinkRunner sinkRunner = new SinkRunner(proc); sinkRunner.start(); ChannelSelector rcs = new ReplicatingChannelSelector(); rcs.setChannels(Collections.singletonList(channel)); ChannelProcessor chp = new ChannelProcessor(rcs); source.setChannelProcessor(chp); try { source.start(); Thread.sleep(500); source.stop(); System.out.println(getTestTraceHead("[TwitterSourceTest.basic]") + "- OK - Twitter source started properly."); } catch (AssertionError e) { System.out.println(getTestTraceHead("[TwitterSourceTest.basic]") + "- FAIL - Twitter source could not start."); throw e; } // try catch sinkRunner.stop(); sink.stop(); }