Hello
I have implemented basic RabbitMQ message sending and receiving on my SpringBoot application, however I am unsure if this can actually be used for mail between 2 users and it feels more like it should be used for notifications?
If this is the case, I have a message sender implemented that will send a message /mail from the sender to the listener. However, I don't understand how I can actually then access the queue for each user and send them the message as an API response.
u/PostMapping("/send-message")
public ResponseEntity<?> sendMessage(@RequestBody final MessagingRequest sendMessageRequest) {
rabbitTemplate.convertAndSend("", "user-mail", sendMessageRequest);
return ResponseEntity.ok(null);
}
Service:
u/RabbitListener(queues = {"q.user-mail"})
public void onUserSendMail(MessagingRequest event) {
log.info("User mail Event Received: {}", event);
rabbitTemplate.convertAndSend("x.post-send-message", "", event);
}
Like for each user how do I check the g.user-mail queue constantly to look for messages on the queue and then access those messages and send them to the user?
It is a REST API, not a self-contained application.
Thanks
submitted by /u/joedev2
[link] [comments]
from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/fQd51Uq