The example is using Spring Integration to receive the JMS message. There are two approaches:
- using
JmsDestinationPollingSource
- message-driven approach using the
JmsMessageDrivenEndpoint
- Install and start ActiveMQ:
brew install activemq
brew services start activemq
- Verify that you access:
http://localhost:8161/admin/
credentials: admin/admin
- Start hawtio client:
java -jar hawtio-app-1.5.4.jar --port 9999
- Start hawtio agent:
On the http://localhost:9999/hawtio
click on the Connect
tab, then Local
then Apache ActiveMQ
and then click Start the agent
.
Agent URL will be provided and then click on it.
- Install and start H2:
brew install h2
brew services start h2
- Verify that you can access the H2 console:
http://localhost:8082/
- Start app with the
InboudChannelAdapterExample
providing the--spring.mail.username=<username>
and--spring.mail.password=<password>
program arguments. - Send a message to the
notification
queue.
<notification>
<email>[email protected]</email>
<status>ORDER_DISPATCHED</status>
</notification>
- Verify that the Spring Batch job is triggered and an email is sent to
[email protected]
- Start the app with the
MessageDrivenChannelAdapterExample
- Send a message to the
trade
queue.
<trade>
<stock>AAPL</stock>
<quantity>100</quantity>
<action>BUY</action>
</trade>
- Verify that the Spring Batch job is triggered and the trade is logged in the console.