All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.fezlight.eventsystem.EventService Maven / Gradle / Ivy

Go to download

This library is dedicated for Spring Boot application and is an implementation of an event system integrated with RabbitMQ and Spring-Modulith-Events.

The newest version!
package fr.fezlight.eventsystem;

import fr.fezlight.eventsystem.config.properties.EventProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;

public class EventService {
    private static final Logger log = LoggerFactory.getLogger(EventService.class);

    private final RabbitTemplate rabbitTemplate;
    private final EventProperties eventProperties;

    public EventService(RabbitTemplate rabbitTemplate, EventProperties eventProperties) {
        this.rabbitTemplate = rabbitTemplate;
        this.eventProperties = eventProperties;
    }

    public void reprocessAllFailedMessage() {
        log.debug("Retrying all failed event...");

        while (rabbitTemplate.receiveAndReply(eventProperties.getRabbit().getQueue().getError().getName(), message -> message))
            ;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy