Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/snowdrop/messaging-work-queue-example

Example application demonstrating how to dispatch tasks to a scalable set of worker processes using a message queue
https://github.com/snowdrop/messaging-work-queue-example

amqp booster example kubernetes messaging openshift rhoar spring-boot

Last synced: 5 days ago
JSON representation

Example application demonstrating how to dispatch tasks to a scalable set of worker processes using a message queue

Awesome Lists containing this project

README

        

= Messaging Work Queue Mission for Spring Boot
:toc: left

== Purpose

This mission example demonstrates how to dispatch tasks to a scalable
set of worker processes using a message queue. It uses the AMQP 1.0
message protocol to send and receive messages.

== Prerequisites

- JDK 11+ installed with JAVA_HOME configured appropriately
- The user has access to an OpenShift instance and is logged in.
- The user has selected a project in which the frontend and backend
processes will be deployed.

== Modules

The `frontend` module serves the web interface and communicates with
workers in the backend.

The `worker` module implements the worker service in the backend.

== Deployment

=== With Dekorate

Run the following commands to configure and deploy the applications.

[source,shell script]
----
oc apply -f .openshiftio/amq.yaml

oc new-app --template=amq-broker-72-basic \
-p APPLICATION_NAME=work-queue-broker \
-p IMAGE_STREAM_NAMESPACE=$(oc project -q) \
-p AMQ_NAME=work-queue-broker \
-p AMQ_PROTOCOL=amqp \
-p AMQ_USER=work-queue \
-p AMQ_PASSWORD=work-queue
----

Deploy frontend:

[source,shell script]
----
./mvnw clean verify -pl frontend -Popenshift -Ddekorate.deploy=true
----

Deploy worker:

[source,shell script]
----
./mvnw clean verify -pl worker -Popenshift -Ddekorate.deploy=true
----

== Deploying application on OpenShift using Helm

First, make sure you have installed the Helm command line and connected/logged to a kubernetes cluster.

Then, you need to install the example by doing:

[source,shell script]
----
helm install messaging ./helm --set frontend.route.expose=true --set frontend.s2i.source.repo=https://github.com/snowdrop/messaging-work-queue-example --set frontend.s2i.source.ref= --set worker.route.expose=true --set worker.s2i.source.repo=https://github.com/snowdrop/messaging-work-queue-example --set worker.s2i.source.ref=
----

**note**: Replace `` with one branch from `https://github.com/snowdrop/messaging-work-queue-example/branches/all`.

And to uninstall the chart, execute:

[source,shell script]
----
helm uninstall messaging
----

== Deploying application on Kubernetes using Helm

Requirements:
- Have installed [the Helm command line](https://helm.sh/docs/intro/install/)
- Have connected/logged to a kubernetes cluster

You need to install the example by doing:

[source,shell script]
----
helm install messaging ./helm --set worker.ingress.host= --set frontend.ingress.host=
----

**note**: Replace `` with one branch from `https://github.com/snowdrop/messaging-work-queue-example/branches/all`.

And to uninstall the chart, execute:

[source,shell script]
----
helm uninstall messaging
----

## Running integration tests using Dekorate

Note: integration tests are executed on a current namespace, so make sure to not run them in a production environment.

To execute the tests run the following command:
[source,shell script]
----
./run_tests_with_dekorate_in_ocp.sh
----

== Running integration tests using S2i

[source,shell script]
----
./run_tests_with_s2i.sh
----

This script can take 2 parameters referring to the repository and the branch to use to source the images from.

[source,shell script]
----
./run_tests_with_s2i.sh "https://github.com/snowdrop/messaging-work-queue-example" branch-to-test
----

== Running Tests on OpenShift using Helm

[source,shell script]
----
./run_tests_with_helm_in_ocp.sh
----

This script can take 2 parameters referring to the repository and the branch to use to source the images from.

[source,shell script]
----
./run_tests_with_helm_in_ocp.sh "https://github.com/snowdrop/messaging-work-queue-example" branch-to-test
----

== Running Tests on Kubernetes using Helm

First, you need to create the k8s namespace:

[source,shell script]
----
kubectl create namespace
----

Then, run the tests by specifying the container registry and the kubernetes namespace:
[source,shell script]
----
./run_tests_with_helm_in_k8s.sh
----

For example:

[source,shell script]
----
./run_tests_with_helm_in_k8s.sh "quay.io/user" "myNamespace"
----