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 newRabbitMQNotificationPublisher
that connects to RabbitMQ using the givenConnectionFactory
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
publish
(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 newRabbitMQNotificationPublisher
that connects to RabbitMQ using the givenConnectionFactory
.- Parameters:
connectionFactory
- theConnectionFactory
to use to create connections to RabbitMQobjectSerializer
- theObjectSerializer
to use to serialize notifications
-
-
Method Details
-
publish
Description copied from interface:NotificationPublisher
Publishes a number of notifications to the given publication channel.- Specified by:
publish
in interfaceNotificationPublisher
- Parameters:
notifications
- a list ofNotifications
to publishpublicationChannel
- the name of the publication channel- Throws:
IOException
- if publishing failed
-