Class ClientFactoryImpl

    • Constructor Detail

      • ClientFactoryImpl

        public ClientFactoryImpl​(java.lang.String scope,
                                 Controller controller,
                                 ClientConfig config)
        Creates a new instance of ClientFactory class. Note: Controller is closed when close() is invoked.
        Parameters:
        scope - The scope string.
        controller - The reference to Controller.
        config - The client config.
      • ClientFactoryImpl

        public ClientFactoryImpl​(java.lang.String scope,
                                 Controller controller,
                                 ConnectionFactory connectionFactory)
        Creates a new instance of the ClientFactory class. Note: ConnectionFactory and Controller is closed when close() is invoked.
        Parameters:
        scope - The scope string.
        controller - The reference to Controller.
        connectionFactory - The reference to Connection Factory impl.
      • ClientFactoryImpl

        public ClientFactoryImpl​(java.lang.String scope,
                                 Controller controller,
                                 ClientConfig config,
                                 ConnectionFactory connectionFactory)
        Creates a new instance of the ClientFactory class. Note: ConnectionFactory and Controller is closed when close() is invoked.
        Parameters:
        scope - The scope string.
        controller - The reference to Controller.
        config - The client config.
        connectionFactory - The reference to Connection Factory impl.
      • ClientFactoryImpl

        public ClientFactoryImpl​(java.lang.String scope,
                                 Controller controller,
                                 ConnectionPool pool)
        Creates a new instance of the ClientFactory class. Note: ConnectionFactory and Controller is closed when close() is invoked.
        Parameters:
        scope - The scope string.
        controller - The reference to Controller.
        pool - The connection pool
    • Method Detail

      • createEventWriter

        public <T> EventStreamWriter<T> createEventWriter​(java.lang.String streamName,
                                                          Serializer<T> s,
                                                          EventWriterConfig config)
        Description copied from interface: EventStreamClientFactory
        Creates a new writer that can write to the specified stream. Uses an autogenerated writerId to refer to this writer.
        Specified by:
        createEventWriter in interface EventStreamClientFactory
        Type Parameters:
        T - The type of events.
        Parameters:
        streamName - The name of the stream to write to.
        s - The Serializer.
        config - The writer configuration.
        Returns:
        Newly created writer object
      • createEventWriter

        public <T> EventStreamWriter<T> createEventWriter​(java.lang.String writerId,
                                                          java.lang.String streamName,
                                                          Serializer<T> s,
                                                          EventWriterConfig config)
        Description copied from interface: EventStreamClientFactory
        Creates a new writer that can write to the specified stream.
        Specified by:
        createEventWriter in interface EventStreamClientFactory
        Type Parameters:
        T - The type of events.
        Parameters:
        writerId - An name which identifies this writer.
        streamName - The name of the stream to write to.
        s - The Serializer.
        config - The writer configuration.
        Returns:
        Newly created writer object
      • createTransactionalEventWriter

        public <T> TransactionalEventStreamWriter<T> createTransactionalEventWriter​(java.lang.String writerId,
                                                                                    java.lang.String streamName,
                                                                                    Serializer<T> s,
                                                                                    EventWriterConfig config)
        Description copied from interface: EventStreamClientFactory
        Creates a new transactional writer that can write to the specified stream atomically.
        Specified by:
        createTransactionalEventWriter in interface EventStreamClientFactory
        Type Parameters:
        T - The type of events.
        Parameters:
        writerId - An name which identifies this writer.
        streamName - The name of the stream to write to.
        s - The Serializer.
        config - The writer configuration.
        Returns:
        Newly created writer object
      • createReader

        public <T> EventStreamReader<T> createReader​(java.lang.String readerId,
                                                     java.lang.String readerGroup,
                                                     Serializer<T> s,
                                                     ReaderConfig config)
        Description copied from interface: EventStreamClientFactory
        Creates (or recreates) a new reader that is part of a ReaderGroup. The reader will join the group and the members of the group will automatically rebalance among themselves. In the event that the reader dies, the method ReaderGroup.readerOffline(String, Position) should be called, passing the last position of the reader (Usually done by storing the position along with the output when it is processed.) Which will trigger redistribute the events among the remaining readers.

        Note that calling reader offline while the reader is still online may result in multiple readers within the group receiving the same events.

        Specified by:
        createReader in interface EventStreamClientFactory
        Type Parameters:
        T - The type of events.
        Parameters:
        readerId - A unique name (within the group) for this reader.
        readerGroup - The name of the group to join.
        s - The serializer for events.
        config - The reader's configuration.
        Returns:
        Newly created reader object that is a part of reader group
      • createReader

        public <T> EventStreamReader<T> createReader​(java.lang.String readerId,
                                                     java.lang.String readerGroup,
                                                     Serializer<T> s,
                                                     ReaderConfig config,
                                                     java.util.function.Supplier<java.lang.Long> nanoTime,
                                                     java.util.function.Supplier<java.lang.Long> milliTime)
      • createStateSynchronizer

        public <StateT extends Revisioned,​UpdateT extends Update<StateT>,​InitT extends InitialUpdate<StateT>> StateSynchronizer<StateT> createStateSynchronizer​(java.lang.String streamName,
                                                                                                                                                                            Serializer<UpdateT> updateSerializer,
                                                                                                                                                                            Serializer<InitT> initialSerializer,
                                                                                                                                                                            SynchronizerConfig config)
        Description copied from interface: SynchronizerClientFactory
        Creates a new StateSynchronizer that will work on the specified stream.
        Specified by:
        createStateSynchronizer in interface SynchronizerClientFactory
        Type Parameters:
        StateT - The type of the state being synchronized.
        UpdateT - The type of the updates being written.
        InitT - The type of the initial update used.
        Parameters:
        streamName - The name of the stream for the synchronizer.
        updateSerializer - The serializer for updates.
        initialSerializer - The serializer for the initial update.
        config - The synchronizer configuration.
        Returns:
        Newly created StateSynchronizer that will work on the given stream.