io.fluxcapacitor.javaclient.common.serialization.DeserializingMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
Default Java client library for interfacing with Flux Capacitor.
package io.fluxcapacitor.javaclient.common.serialization;
import io.fluxcapacitor.common.MessageType;
import io.fluxcapacitor.common.Registration;
import io.fluxcapacitor.common.api.Metadata;
import io.fluxcapacitor.common.api.SerializedMessage;
import io.fluxcapacitor.common.handling.HandlerInspector.MethodHandlerInvoker;
import io.fluxcapacitor.common.handling.MethodInvokerFactory;
import io.fluxcapacitor.common.handling.ParameterResolver;
import io.fluxcapacitor.javaclient.common.Message;
import io.fluxcapacitor.javaclient.modeling.AggregateIdResolver;
import io.fluxcapacitor.javaclient.modeling.AggregateTypeResolver;
import io.fluxcapacitor.javaclient.tracking.handling.DeserializingMessageParameterResolver;
import io.fluxcapacitor.javaclient.tracking.handling.MessageParameterResolver;
import io.fluxcapacitor.javaclient.tracking.handling.MetadataParameterResolver;
import io.fluxcapacitor.javaclient.tracking.handling.PayloadParameterResolver;
import io.fluxcapacitor.javaclient.tracking.handling.authentication.UserParameterResolver;
import lombok.AllArgsConstructor;
import lombok.Value;
import lombok.experimental.Delegate;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static java.time.Instant.ofEpochMilli;
import static java.util.stream.Collectors.toList;
@Value
@AllArgsConstructor
@Slf4j
public class DeserializingMessage {
public static MessageFormatter messageFormatter = MessageFormatter.DEFAULT;
public static List> defaultParameterResolvers =
Arrays.asList(new DeserializingMessageParameterResolver(),
new PayloadParameterResolver(), new MetadataParameterResolver(),
new MessageParameterResolver(), new AggregateIdResolver(),
new AggregateTypeResolver(), new UserParameterResolver());
public static MethodInvokerFactory defaultInvokerFactory = MethodHandlerInvoker::new;
private static final ThreadLocal> messageCompletionHandlers = new ThreadLocal<>();
private static final ThreadLocal> batchCompletionHandlers = new ThreadLocal<>();
private static final ThreadLocal