Interface Subscriber<V>
- Type Parameters:
V
- The value that will be received
- All Known Subinterfaces:
Processor<I,O>
,Processor.Iso<V>
,Processor.Transactional<I,O>
,Processor.TransactionalIso<V>
,TransactionalSubscriber<V>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Subscriber<V>
A listener to events that may be called by an
Publisher
.
For every publisher this subscriber is subscribed to, the subscriber will only process one event at a time -- effectively, within a single publisher this subscriber does not have to be aware of concurrent effects
-
Method Summary
Modifier and Type Method Description default void
onClose()
When thePublisher
this is subscribed to closes without error, this method will be called.default void
onError(Throwable e)
When an error occurs while subscribing to anPublisher
, or is thrown during the execution ofsubmit(Object)
that is not otherwise handled, this method will be called with the error.void
submit(V item)
Called to submit a new item
-
Method Details
-
submit
Called to submit a new item- Parameters:
item
- The item available
-
onError
When an error occurs while subscribing to anPublisher
, or is thrown during the execution ofsubmit(Object)
that is not otherwise handled, this method will be called with the error. The associatedPublisher
will not send further update signals after an error is thrown.- Parameters:
e
- The exception thrown
-
onClose
When thePublisher
this is subscribed to closes without error, this method will be called.
-