Search in sources :

Example 6 with FakeSink

use of streamer.debug.FakeSink in project cloudstack by apache.

the class Queue method main.

/**
     * Example.
     */
public static void main(String[] args) {
    // System.setProperty("streamer.Link.debug", "true");
    System.setProperty("streamer.Element.debug", "true");
    Element source1 = new FakeSource("source1") {

        {
            delay = 100;
            numBuffers = 10;
            incommingBufLength = 10;
        }
    };
    Element source2 = new FakeSource("source2") {

        {
            delay = 100;
            numBuffers = 10;
            incommingBufLength = 10;
        }
    };
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.add(source1);
    pipeline.add(source2);
    pipeline.add(new Queue("queue"));
    pipeline.add(new FakeSink("sink"));
    // Main flow
    pipeline.link("source1", "in1< queue");
    pipeline.link("source2", "in2< queue");
    pipeline.link("queue", "sink");
    new Thread(pipeline.getLink("source1", STDOUT)).start();
    new Thread(pipeline.getLink("source2", STDOUT)).start();
    pipeline.getLink("sink", STDIN).run();
}
Also used : FakeSink(streamer.debug.FakeSink) FakeSource(streamer.debug.FakeSource) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue)

Aggregations

FakeSink (streamer.debug.FakeSink)6 Element (streamer.Element)3 Pipeline (streamer.Pipeline)3 PipelineImpl (streamer.PipelineImpl)3 BaseElement (streamer.BaseElement)2 ByteBuffer (streamer.ByteBuffer)2 FakeSource (streamer.debug.FakeSource)2 MockSource (streamer.debug.MockSource)2 ScreenDescription (common.ScreenDescription)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 MockSink (streamer.debug.MockSink)1