- Index

< Previous |  | Next >

# Using Control Stream Features

## The System Container

When a StreamBase Server process starts up, an EventFlow container named `system` is always included. There are several `system` streams within the server, as listed in The System Container. You can see the streams in a running fragment by issuing an sbc list command.

This page discusses features of the `control` stream in the `system` container.

## Connecting to the Control Stream

Container connections to the control stream from customer-written management modules should use the default asynchronous connection type. Synchronous connections to the control stream are not prevented, but produce a warning message instead of an error.

### Caution

Synchronous connections to the `system.control` stream can hamper the functioning of the system container or of the StreamBase server itself.

## The Control Stream Schema

Tuples are emitted from the control stream's output port in response to certain system-level events. These tuples have the following schema:

Field | Type
--- | ---
subsystem | string
id | int
param0 | string
param1 | string
param2 | string

The use and meanings of fields in the control stream schema differs according to which control stream subsystem sent the tuple. The subsystems are: HA, CONTAINER, and Heartbeat.

### Control Stream Schema for the HA Subsystem

The control stream schema for the HA subsystem is deprecated. Migrate your legacy applications to use the high availability services of the StreamBase Runtime.

### Control Stream Schema for the CONTAINER Subsystem

The control stream schema has the following meanings for tuples emitted from the CONTAINER subsystem:

Field | Type | Description
--- | --- | ---
subsystem | string | String literal `CONTAINER`
id | int | Contains one of:
-100 | for STARTING events
0 | for START events
100 | for STOPPING events
200 | for STOPPED events
param0 | string | Contains the name of the container whose start or stop event is being reported.
param1 | string | Contains one of `STARTING`, `START`, `STOPPING`, or `STOPPED`. The meanings of these event states are described in more detail in The Container Subsystem below.
param2 | string | Not currently used.

### Control Stream Schema for the Heartbeat Subsystem

The control stream schema has the following meanings for tuples emitted from the Heartbeat subsystem:

Field | Type | Description
--- | --- | ---
subsystem | string | String literal `heartbeat`
id | int | Contains the heartbeat period in seconds.
param0 | string | Contains the number of seconds in the current heartbeat event, converted to a string.
param1 | string | Not currently used.
param2 | string | Not currently used.

## The Container Subsystem

The CONTAINER subsystem of the `system` container's `control` stream sends the event tuples described in the following table:

id Field | Param1 Field | Description
--- | --- | ---
-100 | STARTING | A request to start the specified container has been received by the Server, but the container has not completed startup. While the STARTING tuple is sent on the control stream, the container being added does not see this tuple, as it has not yet finished starting. Instead, the STARTING tuple is seen by other containers. For example, add container X with a container connection to the `control` stream; container X itself does not see its own STARTING tuple. Now add container Y, also with a container connection to `control`; container Y also does not see its own STARTING tuple. However, container X does see container Y's STARTING tuple.
0 | START | The specified container has completed startup.
100 | STOPPING | A request to stop the specified container has been received by the Server, but the container has not completed stopping.
200 | STOPPED | The specified container has successfully stopped.

If the specified container is removed and re-added, another pair of event tuples are sent.

### Note

The container START event is not guaranteed to be the first event processed by applications being started in the newly added container. In most cases, it is the first event, but not all cases.