Skip to content

kevbrain/probable-minuteold

Repository files navigation

Messaging Work Queue Mission for Spring Boot

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

  • 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

From a template

Deploy AMQ broker:

oc apply -f ./service.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:

oc apply -f ./frontend/.openshiftio/application.yaml

oc new-app --template=spring-boot-messaging-work-queue-frontend \
  -p SOURCE_REPOSITORY_URL=https://github.com/snowdrop/messaging-work-queue-example \
  -p SOURCE_REPOSITORY_REF=master \
  -p SOURCE_REPOSITORY_DIR=frontend

Deploy worker:

oc apply -f ./worker/.openshiftio/application.yaml

oc new-app --template=spring-boot-messaging-work-queue-worker \
  -p SOURCE_REPOSITORY_URL=https://github.com/snowdrop/messaging-work-queue-example \
  -p SOURCE_REPOSITORY_REF=master \
  -p SOURCE_REPOSITORY_DIR=worker

With FMP

Run the following commands to configure and deploy the applications.

oc apply -f ./service.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

./mvnw clean fabric8:deploy -Popenshift

Running integration tests

Note: integration tests are executed on a current namespace, so make sure to not run them in a production environment. Tests will deploy their own broker which might override the existing one.

To execute the tests run the following command:

./mvnw clean verify -Popenshift,openshift-it

About

Generated by the Red Hat Developer Launcher (https://developers.redhat.com/launch)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors