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

de.otto.synapse.endpoint.sender.aws.KinesisMessageSenderEndpointFactory Maven / Gradle / Ivy

Go to download

A library used at otto.de to implement Spring Boot based event-sourcing microserivces.

There is a newer version: 0.10.1
Show newest version
package de.otto.synapse.endpoint.sender.aws;

import com.fasterxml.jackson.databind.ObjectMapper;
import de.otto.synapse.endpoint.MessageInterceptorRegistry;
import de.otto.synapse.endpoint.sender.MessageSenderEndpoint;
import de.otto.synapse.endpoint.sender.MessageSenderEndpointFactory;
import de.otto.synapse.translator.JsonStringMessageTranslator;
import de.otto.synapse.translator.MessageTranslator;
import software.amazon.awssdk.services.kinesis.KinesisClient;

import javax.annotation.Nonnull;

public class KinesisMessageSenderEndpointFactory implements MessageSenderEndpointFactory {

    private final MessageInterceptorRegistry registry;
    private final MessageTranslator messageTranslator;
    private final KinesisClient kinesisClient;

    public KinesisMessageSenderEndpointFactory(final MessageInterceptorRegistry registry,
                                               final ObjectMapper objectMapper,
                                               final KinesisClient kinesisClient) {
        this.registry = registry;
        this.messageTranslator = new JsonStringMessageTranslator(objectMapper);
        this.kinesisClient = kinesisClient;
    }

    @Override
    public MessageSenderEndpoint create(final @Nonnull String channelName) {
        final MessageSenderEndpoint messageSender = new KinesisMessageSender(channelName, messageTranslator, kinesisClient);
        messageSender.registerInterceptorsFrom(registry);
        return messageSender;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy