This is a practical example that shows how to build a custom Spring Cloud Stream binder which reads from input files that match the destination name, writes to output files that match the destination name and keeps track of previously read messages in an archive.txt file.
- Install the artifact in your local repository by running:
mvn clean install
- Import the
it.dsibilio:spring-cloud-stream-custom-binder:0.0.1-SNAPSHOT
dependency in a client project that relies on Spring Cloud Stream for communication - Add a file to the client project classpath with its name matching the one of your destination name (eg. spring.cloud.stream.bindings.my-input requires a my-input file in the classpath)
- Write something to this file and verify that your application consumes the event!
You can try this custom binder out without the need to develop your own client application by referring to the embedded sample project which relies on this binder.
For further reference, please consider the following sources: