Commit bc3790bd authored by Noel Alonso's avatar Noel Alonso
Browse files

Envía al log las notificaciones recibidas

parent 0fc8722a
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
package es.redmic.notificationmanager.common.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaHandler;
import org.springframework.kafka.annotation.KafkaListener;
@@ -12,6 +14,8 @@ import es.redmic.notificationmanager.mail.service.EmailService;
@KafkaListener(topics = "${broker.topic.alert}")
public class NotificationController {

	protected static Logger logger = LogManager.getLogger();

	EmailService service;

	@Autowired
@@ -22,7 +26,8 @@ public class NotificationController {
	@KafkaHandler
	public void listen(Message event) {

		//TODO: si type no es email, llamar al servicio adecuado.
		// TODO: decidir el canal para llamar al servicio adecuado.
		service.sendSimpleMessage(event.getTo(), event.getSubject(), event.getMessage());
		logger.info("Recibida notificación -> {}: {}", event.getSubject(), event.getMessage());
	}
}