- Index

< Previous |  | Next >

# Legacy Connection to Docker Images

This page describes how to send data to and receive data from a Docker-contained application, both manually and with a feed simulation.

This page demonstrates the use of legacy StreamBase command-line tools to connect to a known port designated as part of a StreamBase URI. The next page demonstrates connecting to the containerized application using only an administrative port and epadmin commands.

## Prerequisites

This page assumes:

- You have the Docker for Windows or Docker for Mac client program installed and running on the host machine.

- You have a Docker image available. For steps to create a Docker image from StreamBase Studio, see Creating and Running Docker Images.

- You have installed that Studio-built Docker image into a Docker container, running and managed by the Docker client programs on your development host machine. Again, see Creating and Running Docker Images.

See the Prerequisites section of the Creating Docker Images page for important information on the limitations and complications of the Docker for Windows product.

The next section demonstrates how to use legacy StreamBase tools to send data to a StreamBase Application running in a Docker container.

## Sending Data Manually with Legacy Commands

This procedure assumes `firstapp` is running in a Docker container using the default StreamBase port, 10000. On the Creating and Running Docker Images page, you ran the Docker image with a command that redirected the local machine's ports 2000 and 10000 to the Docker container's ports 2000 and 10000. The commands on this page contact the default port 10000 as if contacting a locally running StreamBase application.

First, send manually enqueued tuples:

1. To verify that you are not running a StreamBase application locally on your host machine, run `epadmin display services`. The command returns silently if no services are running.

   (This command might return a list of services on other machines in your local subnet. In this case, run:

       epadmin display services --servicename=clustername

   where `clustername` is usually your system login name. See Clusters.)

2. Connect to the StreamBase node running in the Docker container, and run the same command prefixed with docker exec firstapp:

       docker exec firstapp epadmin display services

3. Compare the output of the two epadmin display services commands. This confirms that you are not running a StreamBase application locally but are running one in the Docker container.

4. Open a StreamBase Command Prompt (Windows) or StreamBase-configured shell prompt (macOS). This is window 1.

5. In window 1, set up a dequeue. Run: `sbc dequeue`.

6. Set up an enqueue. Open another command window and run: `sbc enq TradesIn`. This is window 2.

7. Send data manually. In window 2, send the following tuples:

   - ibm,4000

   - yhoo,5600

   - goog,12000

8. Observe the following in window 1:

   - AllTheRest,ibm,4000

   - AllTheRest,yhoo,5600

   - BigTrades,goog,12000

9. Type Ctrl+C in both command windows to stop the enqueue and dequeue processes. Leave the command windows running.

## Sending Data with a Feed Simulation

Next, run a feed simulation to enqueue tuples:

10. In window 1, run: `sbc deq BigTrades.`

11. In window 2, run: `sbc deq AllTheRest`.

12. Notice that no output is produced yet. The command windows are waiting to show output from the two output streams.

13. Return to StreamBase Studio, using the same workspace used in Creating Docker Images.

14. In your `sample_firstapp` project, navigate to `src/main/resources` and select that folder name.

15. Right-click and select StreamBase → Open Command Prompt Here (Windows) or Open Command Terminal Here (macOS).

16. In the new Command Prompt (window 3), run `sbfeedsim -f firstapp-enum.sbfs`

17. Data now flows to the two output ports. Only trades with stock quantities over 10000 go to the BigTrades port.

18. Type Ctrl+C in window 3 to end the feed simulation.

19. Type Ctrl+C in windows 1 and 2 to close the dequeue windows.

## Stop and Remove the Container

To stop the containerized application, run either:

    docker stop firstapp
    docker container stop firstapp

Give the `stop` command a moment to complete. To then remove the containerized application, run either:

    docker rm firstapp
    docker container rm firstapp

## Next Steps

Continue to epadmin Connection to Docker Images to see how to connect to a containerized application using only an administrative port and epadmin commands.