Part 3 (Comms)

In this section of the tutorial, we will add communications to your pipeline, so that we can inspect what is going on.

Adding HTTP Communications

The standard method of communications between pipelines in Ark is HTTP. You can add the HTTP stage to your pipeline by editing the ${APP_ROOT}/tutorial/pipeline/ file.

Let’s change the C++ code to look like:

#include "tutorial/first_stage/first_stage.hh"

#include "ark/comms/stages/http_server_stage.hh"
#include "ark/main/main_offboard.hh"

int main(int argc, const char **argv)
    ark::pipeline::Pipeline pipeline;


    // Add the "HttpServerStage" to your pipeline.

    return ark::main::execute_realtime_pipeline(argc, argv, std::move(pipeline));

Change your CMake to:


    PRIVATE first_stage ark::main_offboard ark::http_server_stage)

Compile and run:


You should now see:

~/ark$ ./build/tutorial_pipeline
(2022-02-02 10:57:47.235) [warn] ( The publisher /my_strings (in stage FirstStage) was not connected to any subscribers.
(2022-02-02 10:57:47.236) [info] ( HTTP Server is listening on "".

The server is up and listening on port 8080. In a future tutorial, we’ll go through how to configure the server to run on different ports.

In the meantime, open another terminal, and use ark-spy to inspect the pipeline:

~/ark$ ./build/ark-spy

This lists the three channels that we have available. Let’s try to spy on the timing reports:

./build/ark-spy -c /scope_timing_reports

Timing reports are emitted every 5 seconds or so, so be patient. You should eventually see a large blob of JSON on the screen. Hit CTRL+C to exit.

Let’s try to spy on your channel next:

~/ark$ ./build/ark-spy -c /my_strings
FATAL: Couldn't fetch the schema for the requested channel. This typically means that that the type that flows on this channel is not serializable. The HTTP response code was 500.

As you can see, this fails, because the type we are publishing is not serializable! Let’s move on to Step 4 to learn about serialization.