Code Examples
A repository of 155 code examples for BeepBeep
basic.QueueSinkUsage Class Reference

Push events into a QueueSink processor. More...

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Push events into a QueueSink processor.

Graphically, the queue sink is represented as follows:

Processor graph

Since it is a sink, it has no output stream.

The expected output of this program is:

Events in the sink: [foo, bar]
Events in the sink: [bar, baz]
Author
Sylvain Hallé Easy

Definition at line 41 of file QueueSinkUsage.java.

Member Function Documentation

◆ main()

static void basic.QueueSinkUsage.main ( String []  args)
static

Create a sink

Definition at line 43 of file QueueSinkUsage.java.

44  {
45  /// Create a sink
46  QueueSink sink = new QueueSink();
47  // Get a reference to the sink's Pushable
48  Pushable p = sink.getPushableInput();
49  // Push a few events into the sink
50  p.push("foo");
51  p.push("bar");
52  // Get a reference to the sink's queue, where events are stored
53  Queue<Object> queue = sink.getQueue();
54  System.out.println("Events in the sink: " + queue);
55  // Events remain in the queue as long as you pop them out
56  queue.remove(); // Removes the first event
57  p.push("baz"); // Push another one
58  System.out.println("Events in the sink: " + queue);
59  ///
60  }

The documentation for this class was generated from the following file: