Class EventBusSinkManager


  • public class EventBusSinkManager
    extends Object
    • Field Detail

      • logger

        private final io.vertx.core.impl.logging.Logger logger
      • classesWhichCodedHaveBeenRegistered

        private final Set<Class> classesWhichCodedHaveBeenRegistered
      • kosContext

        protected final KosContext kosContext
    • Method Detail

      • subscribe

        public <T> void subscribe​(String address,
                                  Class<T> expectedType,
                                  io.vertx.core.Handler<io.vertx.core.eventbus.Message<T>> messageHandler)
        Registers a message consumer messageHandler that will receive messages of the type EventBusSinkManager published into the given address.
        Parameters:
        address - a free-format String. EventPublisherSink implementations might have to parse this address to communicate with external services.
        expectedType - the expected contract used when serialising messages.
        Throws:
        KosException - whenever it reaches a terminal, but unrecoverable state.
      • createProducer

        public <T> io.vertx.core.eventbus.MessageProducer<T> createProducer​(String address,
                                                                            Class<T> expectedType)
        Creates a MessageProducer that expects messages of type EventBusSinkManager.
        Parameters:
        address - a free-format String. EventPublisherSink implementations might have to parse this address to communicate with external services.
        expectedType - the expected contract used when serialising messages.
        Throws:
        KosException - whenever it reaches a terminal, but unrecoverable state.
      • tryInitializeSink

        final <T> EventBusSinkManager.InitializationResult tryInitializeSink​(@NonNull
                                                                             @NonNull String address,
                                                                             Class<T> expectedType,
                                                                             Iterable<? extends EventBusSink> eventBusSinks)
        Initializes the Sink responsible for bridging the communication between the local EventBus with a remote broker, if any. Sinks must be able to successfully finish its initialization. Any Exception thrown during this process will be considered a terminal, non-recoverable state - leading to an abrupt interruption of the whole application.
        Returns:
      • ensureEventBusCanSerializeType

        public <T> void ensureEventBusCanSerializeType​(Class<T> targetType)