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

io.fluxcapacitor.javaclient.publishing.DefaultEventGateway Maven / Gradle / Ivy

There is a newer version: 0.1015.0
Show newest version
package io.fluxcapacitor.javaclient.publishing;

import io.fluxcapacitor.common.api.Metadata;
import io.fluxcapacitor.javaclient.common.serialization.MessageSerializer;
import io.fluxcapacitor.javaclient.publishing.client.GatewayClient;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public class DefaultEventGateway implements EventGateway {

    private final GatewayClient eventGateway;
    private final MessageSerializer serializer;

    @Override
    public void publish(Object payload, Metadata metadata) {
        try {
            eventGateway.send(serializer.serialize(payload, metadata));
        } catch (Exception e) {
            throw new GatewayException(String.format("Failed to publish event %s", payload), e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy