Contents
- EventFlow Container Overview
- Container Name Standards
- Containers and StreamBase Path Notation
- The System Container
- Containers and StreamBase URI Syntax
- Multiple URI Syntax
- Addressing Multiple Containers Independently
- Adding Containers
- Removing Containers
- Getting a List of Containers
- Getting More Information About Containers
- Managing Running Modules in Containers
- Enabling and Disabling Enqueue or Dequeue
- Monitoring Container Information
- Client Library Support for Containers
- Unsupported Features
- Related Topics
StreamBase containers are the building blocks for organizing and connecting a complex EventFlow fragment. There is one EventFlow module per container, and each container name serves as a handle for that module's resources. Multiple containers and modules can be run in a single EventFlow or LiveView engine process, and you can share resources between containers.
Using EventFlow containers enables a number of useful features. You can:
-
Dynamically add or remove EventFlow modules from a running EventFlow engine process.
-
Use containers to run multiple EventFlow modules in a single engine process, with or without connecting the modules' resources.
-
Connect the output of one EventFlow module to the inputs of another EventFlow modules, all running within the same engine.
-
Establish container connections for servers running in separate nodes.
-
Dynamically modify an existing container in a running fragment, to add or change a container connection, or to start, stop, or pause enqueuing or dequeuing.
-
Specify containers and container connections from the command line with the sbadmin command or with the
StreamBaseAdminClient
class.
The following is an example of command-line container commands:
sbadmin addContainer c1 newapp.sbapp sbadmin addContainer c2 myapp-same-schema.sbapp c2.InputStream=c1.OutputStream
This example defines two containers, c1
and c2
, and associates each with an EventFlow module. The last expression specifies that the output of the c1
container is to be consumed by the input stream of the c2
container. Both containers are running in the same EventFlow engine process.
Each container has its own thread of execution within the containing EventFlow engine. Containers behave much like operators or modules marked with the Run this component in a parallel region setting on the Concurrency tab of the Properties view. On a multi-core machine, one container does not block the execution of another container.
The following set of conceptual diagrams illustrates the ideas behind containers. The first diagram illustrates a configuration running multiple unrelated EventFlow modules in a single sbd process:
In the next diagram, we add two reader modules (B and C) to a running EventFlow engine that was already hosting module A:
In the next diagram, we add two writer modules (B and C) to a running engine that was already hosting module A. Then we added module D to write its output stream to the output stream of module A.
Notes
-
In the diagrams above, the EventFlow modules are shown for simplicity as having the same components. This is for illustration only; modules in containers are not required to have the same set of components. However, the streams used in container connections between modules must have the same schema.
-
When removing containers and modules from a running server process, try to remove them in the reverse order that they were added.
The name you assign to containers must follow the StreamBase identifier naming rules, as described in Identifier Naming Rules.
StreamBase's formal path notation is designed to avoid naming conflicts when you run multiple modules in the same server, when you use modules, and when operators are run in separate threads.
StreamBase path notation uses the following syntax, with a period separator between each element:
[containerName
.][moduleRefName
[[.moduleRef2Name
].[..]]entityName
The container name is shown as optional because in most contexts the default container is used and need not be specified.
For additional information, see StreamBase Path Notation.
When an EventFlow engine process starts up, an EventFlow container named system
is always included alongside the container, usually named default
, that holds the top-level EventFlow module. The system container and the streams it emits are described in a separate page,
System Container and Control Streams.
The URI syntax for addressing EventFlow modules with legacy sb* commands allows you to connect to a particular container in a running module. The URI syntax is:
sb://host:port/containerName
For example:
sb://localhost:10000/holder2
If you leave off the container-name
portion of the URI, the container named default
is assumed. Thus, the following commands are equivalent:
sbc -u sb://localhost:10000/default sbc -u sb://localhost:10000
When you specify a container name in the URI, you can omit the container name from any subsequent stream or operator names in the same command. For example, the following commands are equivalent:
sbc -u sb://localhost/holder2 enqueue InputStream1 sbc -u sb://localhost enqueue holder2.InputStream1
See sburi for the details of StreamBase URI syntax.
Some sbc commands that accept StreamBase URIs can specify a comma-separated list of URIs to address two or more EventFlow engines at once. This feature is used primarily to support a cluster of EventFlow engines that are using high availability features.
See Multiple URI Syntax for HA Scenarios for a discussion of this subject.
If a server process has multiple containers, you can enqueue to or dequeue from multiple containers at the same time. For example, you can dequeue with a command like the following:
sbc dequeue holder1.OutputStream1 holder2.OutputStream1
If you specify a container name in the URI, you can still dequeue or enqueue from different containers. For example:
sbc -u sb://localhost/holder1 dequeue OutputStream1 holder2.OutputStream1
OutputStream1
will be dequeued from the module in container holder1
, while holder2.OutputStream1
will be dequeued from the container holder2
.
Because tuples are queued between modules, there is overhead introduced when tuples cross modules.
There are several ways to add a container to a running EventFlow engine process:
-
Use the epadmin add container command with this syntax:
epadmin add container --name=
container-name
--module=module-name
-
Use the sbadmin command, targeting a running server process. The format is:
sbadmin addContainer
container-name
module-name
.sbapp -
Use the
StreamBaseAdminClient
class in a custom client module.
You can remove containers from a running server process with:
-
The epadmin remove container command:
epadmin remove container --name=
container-name
-
The sbadmin command, using this syntax:
sbadmin removeContainer
container-name
-
The
StreamBaseAdminClient
class in a custom client module.
When a container is removed:
-
Enqueuer clients that were accessing the module in that container receive an exception:
ContainerManager$NonExistentContainerException
-
Dequeuer clients receive an EOF if they are dequeuing only from that container. If they are connected to multiple containers, then they continue to receive tuples from the other containers.
-
Containers that depend on a removed container for input or output continue to function. Their input or output disappears.
Use the epadmin --ad=adminport
display container command to show a list of containers, including details about each container. For example:
Engine = com_tibco_sb_sample_bestbidsandasks_BestBidsAsks0 Path = system Type = SYSTEM Enqueue = ENABLED Dequeue = ENABLED State = RUNNING ... Engine = com_tibco_sb_sample_bestbidsandasks_BestBidsAsks0 Path = BBA Type = NORMAL Enqueue = ENABLED Dequeue = ENABLED State = RUNNING Main Module = com.tibco.sb.sample.bestbidsandasks.BestBidsAsks Data Distribution Policy = Availability Zone = Partition = Backup Nodes = Input Streams = NYSE_Feed Output Streams = BestAsks,BestBids Trace Status = Disabled
You can also use the sbc list command, which produces output like the following example:
container default container holder2 container system
The above example shows three containers. One is added and populated by the user, while the other two are standard container in each EventFlow engine.
As shown in the previous section, the epadmin display container command shows several lines of detail about each container. You can add the --detailed
parameter to add the list of referenced modules. For example:
...
Engine = com_tibco_sb_sample_bestbidsandasks_BestBidsAsks0
Path = BBA
Type = NORMAL
Enqueue = ENABLED
Dequeue = ENABLED
State = RUNNING
Main Module = com.tibco.sb.sample.bestbidsandasks.BestBidsAsks
Referenced Modules = {"Module":"com.tibco.sb.sample.bestbidsandasks.BestBidsAsks",
"Referenced Modules":"none"}
Data Distribution Policy =
Availability Zone =
Partition =
Backup Nodes =
Input Streams = NYSE_Feed
...
You can also use the sbc describe
command, which shows you the container name and any connections specified when that container was added.
<container name="BBA" enqueue="ENABLED" dequeue="ENABLED" state="RUNNING"> </container>
You can manage multiple container-bound modules running in a single engine process using either epadmin or sbadmin commands.
The epadmin commands are:
epadmin shutdown container --name=container-name
epadmin suspend container --name=container-name
epadmin resume container --name=container-name
epadmin restart container --name=container-name
epadmin modify container --name=container-name
Use modify container to:
-
configure runtime tuple tracing
-
start, stop, or pause enqueuing to or dequeueing from a container, described next
The relevant sbadmin commands are:
sbadmin {shutdown | suspend | resume}container-name
sbadmin restartContainercontainer-name
sbadmin removeContainercontainer-name
sbadmin modifyContainercontainer-name
Use sbadmin modifyContainer to:
-
add a connection between running containers
-
remove a container connection
-
configure runtime tuple tracing
-
start, stop, or pause enqueuing to or dequeueing from a container, described next
You can dynamically start, stop, and pause enqueuing or dequeuing to and from running containers. Use any of the following commands:
epadmin modify container --name=container-name
epadmin add container --name=container-name
sbadmin addContainercontainer-name
sbadmin modifyContainercontainer-name
All four commands take the following options:
--enqueue=STREAMSTATUS
--dequeue=STREAMSTATUS
The values for STREAMSTATUS
can be:
For epadmin | For sbadmin | Description |
---|---|---|
enabled | ENABLED | This is the default. |
disabled | DISABLED | The enqueue or dequeue will actively refuse any enqueue or dequeue requests, and throw an exception. |
droptuples | DROP_TUPLES | The enqueue or dequeue will silently drop tuples. |
When you interrupt queuing for an module running in a container, you also interrupt queuing for any external clients, input adapters, and output adapters that were communicating with that module. The following table explains how various combinations are affected:
Client or Adapter Type | ENABLED | DROP_TUPLES | DISABLED |
---|---|---|---|
Input adapter | Can enqueue | Off | Off |
Enqueuing client | Can enqueue | Tuples silently dropped | Connections actively refused, with exception thrown |
Output adapter | Can dequeue | off | Off |
Dequeuing client | Can dequeue | Tuples silently dropped | Connections actively refused, with exception thrown |
StreamBase provides a number of ways to monitor container information, as described in Connecting to System Streams.
The StreamBase Client libraries for Java, C++, .NET, and Python support containers. You can write your own modules to connect to and interact with EventFlow engines and the containers therein.
See API Guide for more information.
The following StreamBase features are not supported with containers:
-
Multiple modules per container
-
Ad-Hoc queries