Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the composite permanently and deregisters all elements.
|
static <T,IN,OUT> CompositeStateful<T,IN,OUT> |
create(OUT initialState,
Function<Collection<IN>,OUT> transformer)
Creates a new transformer with an initial state and the transform function that should be applied.
|
static <T,IN,OUT> CompositeStateful<T,IN,OUT> |
create(OUT initialState,
Function<Collection<IN>,OUT> transformer,
BiConsumer<OUT,OUT> beforeTransitionCallback)
Creates a new transformer with an initial state and the transform function that should be applied.
|
void |
deregister(T identifier)
Deregisters a stateful element from the composite.
|
void |
register(T identifier,
Stateful<IN> upstream)
Registers a stateful element with the composite.
|
OUT |
state()
Returns the current state of the stateful component.
|
Flux<OUT> |
states()
Returns a stream of states for this component as they change.
|
public static <T,IN,OUT> CompositeStateful<T,IN,OUT> create(OUT initialState, Function<Collection<IN>,OUT> transformer, BiConsumer<OUT,OUT> beforeTransitionCallback)
initialState
- the initial state.transformer
- the custom transformer for the states.public static <T,IN,OUT> CompositeStateful<T,IN,OUT> create(OUT initialState, Function<Collection<IN>,OUT> transformer)
initialState
- the initial state.transformer
- the custom transformer for the states.public void register(T identifier, Stateful<IN> upstream)
identifier
- the unique identifier to use.upstream
- the upstream flux with the state stream.public void deregister(T identifier)
Note that it might be possible that the passed in identifier is already deregistered (for example if the upstream flux already completed or failed). In this case, this is essentially a "noop" since the target state, the identifier not being part of the stateful component, is already reached.
identifier
- the unique identifier to use.public void close()
public OUT state()
Stateful
Copyright © 2020 Couchbase, Inc.. All rights reserved.