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

io.fluxcapacitor.javaclient.common.serialization.MessageFormatter Maven / Gradle / Ivy

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

import io.fluxcapacitor.javaclient.publishing.routing.RoutingKey;

import java.util.function.Function;

import static io.fluxcapacitor.common.reflection.ReflectionUtils.getAnnotatedPropertyValue;
import static java.lang.String.format;

@FunctionalInterface
public interface MessageFormatter extends Function {
    MessageFormatter DEFAULT = m -> m.isDeserialized() ? getAnnotatedPropertyValue(m.getPayload(), RoutingKey.class)
            .map(key -> format("%s (routing key: %s)", m.getPayloadClass().getSimpleName(), key))
            .orElse(m.getPayloadClass().getSimpleName()) : m.getType();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy