28 lines
1.2 KiB
Plaintext
28 lines
1.2 KiB
Plaintext
== Spring Cloud Stream Multibinder Application with Different Systems
|
|
|
|
This example shows how to run a Spring Cloud Stream application with the same binder type configured for two separate Kafka clusters.
|
|
This sample primarily focuses on demonstrating the `spring.cloud.stream.sendto.destination` header in action.
|
|
|
|
|
|
## Running the application
|
|
|
|
The following instructions assume that you are running Kafka as a Docker image.
|
|
|
|
* Go to the application root
|
|
* `docker-compose up -d`
|
|
|
|
This brings up two Kafka clusters in docker containers.
|
|
Local ports mapped for kafka are 9092 and 9093 (Zookeeper local parts mapped are 2181 and 2182).
|
|
|
|
* `./mvnw clean package`
|
|
|
|
The sample comes with a convenient test producer and consumer to see the processor in action.
|
|
After running the program, watch your console, every second some data is sent to Kafka cluster 1 and it is received through Kafka cluster 2.
|
|
|
|
To run the example, command line parameters for the Zookeeper ensembles and Kafka clusters must be provided, as in the following example:
|
|
```
|
|
java -jar target/<jar-name> --kafkaBroker1=localhost:9092 --zk1=localhost:2181 --kafkaBroker2=localhost:9093 --zk2=localhost:2182
|
|
```
|
|
|
|
You should see the output from the test producer/consumer above.
|