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

org.zalando.nakadiproducer.EventTransmissionScheduler Maven / Gradle / Ivy

There is a newer version: 30.0.0-RC1
Show newest version
package org.zalando.nakadiproducer;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.zalando.nakadiproducer.transmission.impl.EventTransmitter;

public class EventTransmissionScheduler {
    private final EventTransmitter eventTransmitter;
    private final boolean scheduledTransmissionEnabled;

    public EventTransmissionScheduler(EventTransmitter eventTransmitter, @Value("${nakadi-producer.scheduled-transmission-enabled:true}") boolean scheduledTransmissionEnabled) {
        this.eventTransmitter = eventTransmitter;
        this.scheduledTransmissionEnabled = scheduledTransmissionEnabled;
    }

    @Scheduled(fixedDelayString = "${nakadi-producer.transmission-polling-delay:1000}")
    protected void sendEventsIfSchedulingEnabled() {
        if (scheduledTransmissionEnabled) {
            eventTransmitter.sendEvents();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy