Part 10 (Interaction)

This section goes over using ark-put, a tool that allows you to inject messages into an active pipeline.

In one terminal, start your tutorial pipeline up and let it run:

~/ark$ ./build/tutorial_pipeline
(2022-02-02 15:06:08.923) [warn] (log_writer_stage.cc:1559) Pipeline configuration for OrganizationConfig is not found.
(2022-02-02 15:06:08.924) [info] (http_server_stage.cc:874) HTTP Server is listening on "0.0.0.0:8080".
(2022-02-02 15:06:08.941) [info] (log_writer_stage.cc:812) Writing log out to '40bb04d9-47d4-49bd-a9ca-5d6a5d080ddd'.
(2022-02-02 15:06:09.441) [info] (second_stage.cc:39) SecondStage01 stage received message: 'At 0.518175182, my message is 'Configured Message!''
(2022-02-02 15:06:09.441) [info] (second_stage.cc:39) SecondStage02 stage received message: 'At 0.518175182, my message is 'Configured Message!''
(2022-02-02 15:06:09.941) [info] (second_stage.cc:39) SecondStage01 stage received message: 'At 1.018175182, my message is 'Configured Message!''

We’ll next want to turn the logger off. We can do that by injecting messages into the system with ark-put. In this case, we need to send a LogWriterCommand message, as JSON.

The rbuf type looks like this:

enum LogWriterCommandType
{
    NoCommand = 0;
    StartLog = 1;
    StopLog = 2;
    EnableEventBufferForDuration = 3;
    DisableEventBuffer = 4;
}

schema LogWriterCommand
{
    /// Set the desired log (when starting a log).
    string desired_log_name;

    /// The command that is being executed.
    LogWriterCommandType command;

    /// This group is valid for the 'EnableEventBufferForDuration' or the
    /// 'DisableEventBuffer' enum values.
    group 0
    {
        /// This is the name of the event buffer to enable.
        string event_buffer_name;

        /// The duration the event buffer should be enabled for.
        duration event_buffer_duration;
    }
}

From here, we can send a JSON like this:

{
  "command": "StopLog"
}

Let’s do so with ark-put:

echo '{"command": "StopLog"}' | ./build/ark-put -c /logger/control

This will write our message out to the /logger/control channel.

We can then start a new log:

echo '{"command": "StartLog"}' | ./build/ark-put -c /logger/control

If we look in the debug log, we should see something like this:

(2022-02-02 15:09:11.441) [info] (second_stage.cc:39) SecondStage01 stage received message: 'At 182.518175182, my message is 'Configured Message!''
(2022-02-02 15:09:11.441) [info] (second_stage.cc:39) SecondStage02 stage received message: 'At 182.518175182, my message is 'Configured Message!''
(2022-02-02 15:09:11.897) [info] (log_writer_stage.cc:812) Writing log out to 'a55c72e0-5f17-4243-9d7e-aeca762ea6b6'.
(2022-02-02 15:09:11.941) [info] (second_stage.cc:39) SecondStage01 stage received message: 'At 183.018175182, my message is 'Configured Message!''
(2022-02-02 15:09:11.941) [info] (second_stage.cc:39) SecondStage02 stage received message: 'At 183.018175182, my message is 'Configured Message!''

This shows that the pipeline got the message, and started a new log.

You can use ark-put for an easy way to inject messages into pipelines, but it’s generally only useful for debugging.

The GUI is a better way to interact with pipelines, which is discussed in Part 11.