Skip to content

Projects used to demonstrate Spring Cloud Stream and Functions

Notifications You must be signed in to change notification settings

cppwfs/scstdn2022

Repository files navigation

Spring Cloud Stream Past, Present, and Future.

This repository contains the projects that are demoed during the breakout discussion. These projects are meant to provide a quick start for experimenting with various features of Spring Cloud Function and Spring Cloud Stream All samples use RabbitMQ as the Messaging Framework.

Projects

Creek Functions

A collection of functions that can be used with the Producer, Function, and Consumer portions demonstration

Creek Producer

A boot application that will retrieve the creek data from the USGS for a selected set of creeks and send it to the specified destination (rabbit exchange).

Creek Transformer

A boot application transforms USGS Water Information System data to CreekMeasurements s.

Creek Consumer

A boot application that will consume the CreekMeasurement s from the stream and either log or send an sms message containing information on the creeks that are safe-ish to kayak from the provided data.

Note
Do not determine if it is safe to kayak a stream, river, or any body of water based soley on the this analysis. It is for demonstration purposes only.

Creek MeasurementRepository Consumer

A boot application that will consume the CreekMeasurement s from the stream and store them into a repository.

Stream POC

Single App POC that is used as a basic outline for the demo.

SCSt
Figure 1. Process Flow

Running the full demo

Start the consumers

Send Creek Report via SMS

This will send the report to the specified phone number . You must also provide the sms key.

java -jar creekconsumer/target/creekconsumer-0.0.1-SNAPSHOT.jar  --spring.cloud.function.definition='generateReport|sms' --spring.cloud.stream.function.bindings.generateReportsms-in-0=input --spring.cloud.stream.bindings.input.group=sms --io.spring.smsKey=yourkey --io.spring.phoneNumber=+1XXXXXXXXXX
Write Creek Report to console

This will write the report to the console.

java -jar creekconsumer/target/creekconsumer-0.0.1-SNAPSHOT.jar

Start the transformer

java -jar creektransformer/target/creektransformer-0.0.1-SNAPSHOT.jar

Start the Producer

java -jar creekproducer/targecreekproducer-0.0.1-SNAPSHOT.jar

Using Docker and Docker Compose

You can run the following script to build all the projects' docker images by running the following script:

./create-images.sh

Or your can build each of the projects below independently as follows:

Build the docker images per Project:

creekconsumer
cd creekconsumer
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-consumer
creekproducer
cd creekproducer
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-producer
[source,bash]

creektransformer

cd creektransformer
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-transformer
creekmeasurementrepositoryconsumer
cd creekmeasurementrepositoryconsumer
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-storage

Using docker-compose to launch the services.

Now, you can use the following docker-compose.yml file and execute:

link:docker-compose.yml[role=include]
docker-compose up

You can open your browser the RabbitMQ Console to see the Exchanges and Queues created.

The port 3306 is exposed, so you can use a SQL Client for a MySQL/MariaDB and see the Table and data that stores the creek results.

Cleaning up

In another window and in the same folder where you ran the docker-compose command, you can run:

docker-compose down

About

Projects used to demonstrate Spring Cloud Stream and Functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •