Skip to main contentIBM Garage Event-Driven Reference Architecture - Reefer Container Shipment reference implementation

Voyage Management

This service keeps track of each scheduled, current or completed voyage of container carreer vessels, being loaded with containers at a source port, sailing to a destination port and having onboard containers unloaded there.


Description: This microservice manages the voyages for each ship. A voyage consist of carrying a limited amount of goods from a source port to a destination port being the goods carried by a uniquely identified ship on a specific date. All those attributes make a voyage unique and these voyages are managed by this microservice. Voyages microservice will then be responsible to allocate a voyage to an order based on where this order needs to be carried from and to, the window time the goods need to be carried within and the amount of goods to be carried. Written in NodeJS, this microservice assigns a voyage to an order (and manage the remaining capacity on the ship making such voyage) if any suitable voyage is found and emit the consequent VoyageAssigned Event or will otherwise emit a VoyageNotFound Event.

Voyages diagram

Github repository: refarch-kc-ms

Folder: voyage-ms

Kafka topics consumed from:

Kafka topics produced to:

Events reacted to:

Events produced:

EDA Patterns implemented:


This microservice is built using the Appsody development framework. The Appsody CLI is a required prerequisite for building the application locally.

Appsody will build the application by pulling the contents of the Appsody Stack it is based on and then performing the local application build inside the containerized environment:

appsody build -t <yournamespace>/kcontainer-voyages-ms[:tag] [--push]

  • You can optionally specify a container tag. If left blank, latest will be used.
  • You can optionally supply the --push flag to automatically push the built image to specified remote repository.

Performing an Appsody build will update the app-deploy.yaml file in the same directory with current information for the application image, labels, and annotations fields.


Deployment parameters

The following deployment parameters are defined in the app-deploy.yaml file:

KAFKA_BROKERSYESComma-separated list of Kafka brokers to connect to
KAFKA_APIKEYNOAPI Key used to connect to SASL-secured Kafka brokers. This is required when connecting to IBM Event Streams clusters.
CERTS_ENABLEDNORequired to be set to true when connecting to IBM Event Streams on the IBM Cloud Pak for Integration (CP4I).
CERTS_PATHNOThe local path to the required certifcate file when connecting to IBM Event Streams on CP4I. See Volume Mounts below.
ORDER_TOPICYESThe topic name used for communication relating to the orders entity.

Volume Mounts

The Voyage Management microservice requires up to one file to be injected at runtime for proper operation. As noted in the CERTS_PATH parameter above, these files are SSL-based certificates which are required to verfiy the identity of the external service when calling it. These files are provided as --docker-options "-v host-src:container-dest ..." when running the microservice locally and as a Volume Mount when running the microservice on a Kubernetes cluster.

The CERTS_PATH parameter is documented in the Event Streams Certificates section of the Prerequisites page. The Appsody run command should include a parameter similar to -v /Users/myuser/Downloads/es-cert.pem:/etc/ssl/certs/kcontainer/es-cert.pem in its --docker-options string to run this microservice locally.

Example: appsody run --docker-options "-v /Users/myuser/Downloads/es-cert.pem:/etc/ssl/certs/kcontainer/es-cert.pem " ...

Running the microservice locally

When running the microservice locally, you must specify all the required deployment parameters from above as environment variables via the --docker-options flag being passed in from the Appsody CLI command.

Example: appsody run --docker-options "-e KAFKA_BROKERS=remotebroker1:9092,remotebroker2:9092 -e ORDER_TOPIC=orders -v /Users/myuser/Downloads/es-cert.pem:/etc/ssl/certs/kcontainer/es-cert.jks" ...

For more details on running the microservice locally, consult the Appsody run documentation as well as the deployment information contained in the app-deploy.yaml file.

Running the microservice remotely

The Appsody Operator is a required prerequisite for deploying the microservice to a remote Kubernetes or OpenShift cluster.

To deploy the microservice to a remote cluster:

appsody deploy <yournamespace>/kcontainer-voyages-ms[:tag] --no-build

  • You can omit the --no-build flag to have Appsody perform a build before deploying the application.
  • Note: Performing a build at deploy time requires specifying the absolute container reference path, as well as the --push flag.
  • The neccesary deployment parameter information will be read from the app-deploy.yaml file in the same directory.

Usage Details