This repo is Part Four (of eight) of a workshop/activity/tutorial that comprises the "Vac-Seen System". This system is associated with, and specifically created for, the Red Hat OpenShift Sandbox.
At the end of this tutorial you will have an instance of a microservice that is running in an OpenShift cluster. The microservice will generate events into an Apache Kafka topic.
If you need help or get stuck, email devsandbox@redhat.com. If you find a defect, create an Issue in this repository.
The following three prerequisites are necessary:
- An account in OpenShift Sandbox (No problem; it's free). This is not actually necessary, since you can use this tutorial with any OpenShift cluster.
- The
occommand-line tool for OpenShift. There are instructions later in this article for the installation ofoc. - Your machine will need access to a command line; Bash or PowerShell, either is fine.
You can use this activity regardless of whether your PC runs Windows, Linux, or macOS.
This tutorial is structured so that a .NET developer can perform this workshop using free resources: the aformentioned Kafka cluster and Openshift sandbox. In addition, a few open source prerequesites are required.
The scenario is this: Field personnel report the administration of COVID-19 vaccinations. These vaccination events are sent to a Kafka cluster.
This particular repo references a microservice called "vac-seen-generator". It creates simulated vaccination events, which contain the following data:
- RecipientID — string that identifies who got the shot. It's a GUID.
- EventTimestamp — date and time
- CountryCode — the hard-coded, two-character ISO code for the country. Currently "us".
- VaccinationType — string that denotes which vaccination, for example, Pfizer or Moderna.
- ShotNumber — an integer indicating which shot this is for this recipient, i.e. first, second, third, etc. this repository.
This microservice has an API endpoint to which you can post a date. For that date, a random number of random events (from 1 to 40) are added to the Kafka event stream. This API can be called multiple times; it uses the current date and time as the EventTimestamp property. Calling it over and over simply adds more events to the Kafka event stream.
This microservices depends on a Kafka instance and OpenShift Service Binding. Without those two dependencies, this program will do nothing.
The user:
- Creates this vac-seen-generator app in their cluster using the "from Git" option.
- Makes available a managed Kafka instance.
- Binds their managed Kafka cluster to the app using Service Binding.
- Can now use this program.
Run this command get pull the image from the image registry and create the OpenShift application:
oc new-app --name=vac-seen-generator --image=quay.io/donschenck/vac-seen-generator:latest
The microservice is now up and running.
### End ###