The source application will be the producer of stock price change events. It will define an output channel and put a message on the message broker.
Let's use Spring Initializr (https://start.spring.io) to set up the application. Provide the details listed here and click on Generate Project:
- Group: com.mastering.spring.cloud.data.flow
- Artifact: significant-stock-change-source
- Dependencies: Stream Rabbit
Listed here are some of the important dependencies from the pom.xml file:
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-stream-rabbit</artifactId> </dependency>
Update the SpringBootApplication file with the following code:
@EnableBinding(Source.class) @SpringBootApplication ...