From the course: Data Resilience with Spring and RabbitMQ Event Streaming
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Publishing reliably with Spring and RabbitMQ
From the course: Data Resilience with Spring and RabbitMQ Event Streaming
Publishing reliably with Spring and RabbitMQ
- [Instructor] In this video, I'll show you how to reliably publish data to RabbitMQ using Spring. So this time we'll use the payment app instead of the management console to submit the payments. The payment app uses Spring AMQP to publish messages to an exchange in Rabbit. It also exposes an ACDP interface to accept payments. Let's look at the code. The key to this particular example is the MakePaymentConsumer, which is a Spring cloud function. It accepts a payment from ACDP and passes it to a template. This is the RabbitMQ template that is provided to us from Spring AMQP. The templates has a method which is called convertAndSend. Here I'm passing in the name of the exchange, the payment.id, which is equal to the account.id, and then the payment amount. Let's look at the payment object. The payment object, again, just consists of an ID and an amount, which can be any decimal number. So you'll find the examples to follow through this in the GitHub repo. So in this case, what I'll do…