Class RabbitMQNotificationPublisher
java.lang.Object
com.reallifedeveloper.common.infrastructure.messaging.RabbitMQNotificationPublisher
- All Implemented Interfaces:
NotificationPublisher
An implementation of the
NotificationPublisher interface that uses RabbiMQ.- Author:
- RealLifeDeveloper
-
Constructor Summary
ConstructorsConstructorDescriptionRabbitMQNotificationPublisher(com.rabbitmq.client.ConnectionFactory connectionFactory, ObjectSerializer<String> objectSerializer) Creates a newRabbitMQNotificationPublisherthat connects to RabbitMQ using the givenConnectionFactory. -
Method Summary
Modifier and TypeMethodDescriptionvoidpublish(List<Notification> notifications, String publicationChannel) Publishes a number of notifications to the given publication channel.
-
Constructor Details
-
RabbitMQNotificationPublisher
public RabbitMQNotificationPublisher(com.rabbitmq.client.ConnectionFactory connectionFactory, ObjectSerializer<String> objectSerializer) Creates a newRabbitMQNotificationPublisherthat connects to RabbitMQ using the givenConnectionFactory.- Parameters:
connectionFactory- theConnectionFactoryto use to create connections to RabbitMQobjectSerializer- theObjectSerializerto use to serialize notifications
-
-
Method Details
-
publish
Description copied from interface:NotificationPublisherPublishes a number of notifications to the given publication channel.- Specified by:
publishin interfaceNotificationPublisher- Parameters:
notifications- a list ofNotificationsto publishpublicationChannel- the name of the publication channel- Throws:
IOException- if publishing failed
-