{"id":18048040,"url":"https://github.com/ivangfr/spring-cloud-stream-solace-pubsub","last_synced_at":"2026-02-15T07:34:14.765Z","repository":{"id":111328517,"uuid":"404341433","full_name":"ivangfr/spring-cloud-stream-solace-pubsub","owner":"ivangfr","description":"The goal of this project is to play with Solace PubSub+. For it, we will implement a producer and consumer of different types of news about many countries and cities.","archived":false,"fork":false,"pushed_at":"2024-12-15T13:45:48.000Z","size":250,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T09:54:10.516Z","etag":null,"topics":["docker","java","jib","solace-pubsub","spring-boot","spring-cloud-stream","spring-webflux"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivangfr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ivangfr"}},"created_at":"2021-09-08T12:35:41.000Z","updated_at":"2024-12-15T13:45:52.000Z","dependencies_parsed_at":"2025-04-10T09:47:12.078Z","dependency_job_id":"89567c2d-6537-438f-ba41-ef885d142006","html_url":"https://github.com/ivangfr/spring-cloud-stream-solace-pubsub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivangfr/spring-cloud-stream-solace-pubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-cloud-stream-solace-pubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-cloud-stream-solace-pubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-cloud-stream-solace-pubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-cloud-stream-solace-pubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivangfr","download_url":"https://codeload.github.com/ivangfr/spring-cloud-stream-solace-pubsub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-cloud-stream-solace-pubsub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270637236,"owners_count":24620425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","java","jib","solace-pubsub","spring-boot","spring-cloud-stream","spring-webflux"],"created_at":"2024-10-30T20:11:04.908Z","updated_at":"2026-02-15T07:34:14.758Z","avatar_url":"https://github.com/ivangfr.png","language":"Java","funding_links":["https://github.com/sponsors/ivangfr"],"categories":[],"sub_categories":[],"readme":"# spring-cloud-stream-solace-pubsub\n\nThe goal of this project is to play with [`Solace PubSub+`](https://www.solace.dev/). For it, we will implement a producer and consumer of different types of `news` about many countries and cities.\n\n## Proof-of-Concepts \u0026 Articles\n\nOn [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-Concepts (PoCs) and articles. You can easily search for the technology you are interested in by using the filter. Who knows, perhaps I have already implemented a PoC or written an article about what you are looking for.\n\n## Additional Readings\n\n- \\[**Medium**\\] [**Solace PubSub+ and Spring Boot: Implementing News Producer and Consumer Apps**](https://medium.com/@ivangfr/solace-pubsub-and-spring-boot-implementing-news-producer-and-consumer-apps-1f80cb3fed43)\n- \\[**Medium**\\] [**Solace PubSub+ and Spring Boot: Implementing Unit Tests for News Producer and Consumer Apps**](https://medium.com/@ivangfr/solace-pubsub-and-spring-boot-implementing-unit-tests-for-news-producer-and-consumer-apps-6c1b8257f7a0)\n- \\[**Medium**\\] [**Solace PubSub+ and Spring Boot: Implementing End-to-End Tests for News Producer and Consumer Apps**](https://medium.com/@ivangfr/solace-pubsub-and-spring-boot-implementing-end-to-end-tests-for-news-producer-and-consumer-apps-353e5b3843f4)\n- \\[**Medium**\\] [**Solace PubSub+ and Spring Boot: Running News Producer and Consumer Apps in Minikube (Kubernetes)**](https://medium.com/@ivangfr/solace-pubsub-and-spring-boot-running-news-producer-and-consumer-apps-in-minikube-kubernetes-b9fb167a5bbc)\n\n## Applications\n\n- ### producer-service\n\n  [`Spring Boot`](https://docs.spring.io/spring-boot/index.html) application that exposes a REST API to submit `news` events. It published news to the following destination with format: `ps/news/{type}/{country}/{city}`\n\n  Endpoints\n  ```text\n  POST /api/news {\"type\": [SPORT|ECONOMY|HEALTH], \"country\": \"...\", \"city\": \"...\", \"title\": \"...\"}\n  POST /api/news/random {\"number\": ..., \"delay\": ...}\n  ```\n\n- ### consumer-service\n\n  `Spring Boot` application that consumes the `news` events published by `producer-service`.\n\n## Prerequisites\n\n- [`Java 21`](https://www.oracle.com/java/technologies/downloads/#java21) or higher.\n- A containerization tool (e.g., [`Docker`](https://www.docker.com), [`Podman`](https://podman.io), etc.)\n\n## Start Environment\n\nOpen a terminal and inside the `spring-cloud-stream-solace-pubsub` root folder run:\n```bash\ndocker compose up -d\n```\n\n## Running Applications with Maven\n\n  - **producer-service**\n\n    - In a terminal, make sure you are in the `spring-cloud-stream-solace-pubsub` root folder.\n    - Run the commands below:\n      ```bash\n      ./mvnw clean spring-boot:run --projects producer-service\n      ```\n\n  - **consumer-service-1**\n\n    - It subscribes to all news from `Brazil`.\n    - Open a new terminal and navigate to the `spring-cloud-stream-solace-pubsub` root folder.\n    - Run the commands below:\n      ```bash\n      export NEWS_SUBSCRIPTION=\"ps/news/*/BR/\u003e\"\n      ./mvnw clean spring-boot:run --projects consumer-service\n      ```\n\n  - **consumer-service-2** \n\n    - It subscribes to all news related to `HEALTH`.\n    - Open a new terminal and navigate to the `spring-cloud-stream-solace-pubsub` root folder.\n    - Run the commands below:\n      ```bash\n      export SERVER_PORT=9082\n      export NEWS_SUBSCRIPTION=\"ps/news/HEALTH/\u003e\"\n      ./mvnw spring-boot:run --projects consumer-service\n      ```\n\n## Running Applications as Docker containers\n\n- ### Build Docker Images\n\n  - In a terminal, make sure you are inside the `spring-cloud-stream-solace-pubsub` root folder.\n  - Run the following script to build the Docker images:\n    ```bash\n    ./build-docker-images.sh\n    ```\n\n- ### Environment Variables\n\n  - **producer-service**\n\n    | Environment Variable | Description                                                                      |\n    |----------------------|----------------------------------------------------------------------------------|\n    | `SOLACE_HOST`        | Specify host of the `Solace PubSub+` message broker to use (default `localhost`) |\n    | `SOLACE_PORT`        | Specify port of the `Solace PubSub+` message broker to use (default `55556`)     |\n\n  - **consumer-service**\n\n    | Environment Variable | Description                                                                      |\n    |----------------------|----------------------------------------------------------------------------------|\n    | `SOLACE_HOST`        | Specify host of the `Solace PubSub+` message broker to use (default `localhost`) |\n    | `SOLACE_PORT`        | Specify port of the `Solace PubSub+` message broker to use (default `55556`)     |\n\n- ### Run Docker Containers\n\n  - **producer-service**\n\n    Run the following command in a terminal:\n    ```bash\n    docker run --rm --name producer-service \\\n      -p 9080:9080 \\\n      -e SOLACE_HOST=solace -e SOLACE_PORT=55555 \\\n      --network=spring-cloud-stream-solace-pubsub_default \\\n      ivanfranchin/producer-service:1.0.0\n    ```\n\n  - **consumer-service-1**\n\n    - It subscribes to all news from `Brazil`.\n    - Open a new terminal and run the following command:\n      ```bash\n      docker run --rm --name consumer-service-1 \\\n        -p 9081:9081 \\\n        -e SOLACE_HOST=solace -e SOLACE_PORT=55555 \\\n        -e NEWS_SUBSCRIPTION=\"ps/news/*/BR/\u003e\" \\\n        --network=spring-cloud-stream-solace-pubsub_default \\\n        ivanfranchin/consumer-service:1.0.0\n      ```\n\n  - **consumer-service-2**\n\n    - It subscribes to all news related to `HEALTH`.\n    - Open a new terminal and run the following command:\n      ```bash\n      docker run --rm --name consumer-service-2 \\\n        -p 9082:9081 \\\n        -e SOLACE_HOST=solace -e SOLACE_PORT=55555 \\\n        -e NEWS_SUBSCRIPTION=\"ps/news/HEALTH/\u003e\" \\\n        --network=spring-cloud-stream-solace-pubsub_default \\\n        ivanfranchin/consumer-service:1.0.0\n      ```\n\n## Playing around\n\nIn a terminal, submit the following POST requests to `producer-service` and check its logs and `consumer-service` logs.\n\n\u003e **Note**: [HTTPie](https://httpie.io/) is being used in the calls bellow\n\n- Sending `news` one by one\n  \n  - Just `consumer-service-1` should consume:\n    ```\n    http :9080/api/news type=\"SPORT\" country=\"BR\" city=\"SaoPaulo\" title=\"...\"\n    ```\n\n  - Just `consumer-service-2` should consume:\n    ```\n    http :9080/api/news type=\"HEALTH\" country=\"PT\" city=\"Porto\" title=\"...\"\n    ```\n\n  - Neither `consumer-service-1` nor `consumer-service-2` should consume:\n    ```\n    http :9080/api/news type=\"ECONOMY\" country=\"DE\" city=\"Berlin\" title=\"...\"\n    ```\n\n  - Both `consumer-service-1` and `consumer-service-2` should consume:\n    ```\n    http :9080/api/news type=\"HEALTH\" country=\"BR\" city=\"Brasilia\" title=\"...\"\n    ```\n\n- Sending a number of `news` randomly with a specified delay in milliseconds:\n  ```\n  http :9080/api/news/random number=10 delayInMillis=1000 --stream\n  ```\n\n## Useful Links\n\n- **Solace**\n  \n  `Solace` can be accessed at http://localhost:8080 and enter `admin` to both _username_ and _password_.\n\n## Shutdown\n\n- To stop applications, go to the terminals where they are running and press `Ctrl+C`.\n- To stop and remove docker-compose containers, network and volumes, go to a terminal and, inside the `spring-cloud-stream-solace-pubsub` root folder, run the following command:\n  ```\n  docker compose down -v\n  ```\n\n## Running Test Cases\n\nIn a terminal, make sure you are inside the `spring-cloud-stream-solace-pubsub` root folder:\n\n- **producer-service**\n  ```\n  ./mvnw clean test --projects producer-service\n  ```\n\n- **consumer-service**\n  ```\n  ./mvnw clean test --projects consumer-service\n  ```\n\n## Cleanup\n\nTo remove the Docker images created by this project, go to a terminal and, inside the `spring-cloud-stream-solace-pubsub` root folder, run the following script:\n```\n./remove-docker-images.sh\n```\n\n## References\n\n- https://tutorials.solace.dev/spring/spring-cloud-stream/\n\n## Issues\n\nThe default `Solace` SMF port `55555` is not working, at least on my Mac machine. The problem is explained in [this issue](https://github.com/SolaceLabs/solace-single-docker-compose/issues/10). For now, I've changed the mapping port from `55555` to `55556`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspring-cloud-stream-solace-pubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivangfr%2Fspring-cloud-stream-solace-pubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspring-cloud-stream-solace-pubsub/lists"}