Package io.servicetalk.concurrent.api
Class LoggingPublisherSubscriber<T>
- java.lang.Object
-
- io.servicetalk.concurrent.api.LoggingPublisherSubscriber<T>
-
- Type Parameters:
T
- Type of items received by theSubscriber
.
- All Implemented Interfaces:
PublisherSource.Subscriber<T>
public class LoggingPublisherSubscriber<T> extends java.lang.Object implements PublisherSource.Subscriber<T>
APublisherSource.Subscriber
that wraps anotherPublisherSource.Subscriber
, logging all signals received by thePublisherSource.Subscriber
, or sent via thePublisherSource.Subscription
.
-
-
Constructor Summary
Constructors Constructor Description LoggingPublisherSubscriber(java.lang.String name, PublisherSource.Subscriber<T> delegate)
Create aLoggingPublisherSubscriber
that wraps thedelegate
, and uses the specifiedname
for logging.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onComplete()
Callback to signal completion of thePublisherSource
for thisSubscriber
.void
onError(java.lang.Throwable t)
Callback to receive anerror
for thisSubscriber
.void
onNext(T t)
Callback to receive adata
element for thisSubscriber
.void
onSubscribe(PublisherSource.Subscription s)
Callback to receive aPublisherSource.Subscription
for thisSubscriber
.
-
-
-
Constructor Detail
-
LoggingPublisherSubscriber
public LoggingPublisherSubscriber(java.lang.String name, PublisherSource.Subscriber<T> delegate)
Create aLoggingPublisherSubscriber
that wraps thedelegate
, and uses the specifiedname
for logging.- Parameters:
name
- the logging name.delegate
- thePublisherSource.Subscriber
to delegate calls to.
-
-
Method Detail
-
onSubscribe
public void onSubscribe(PublisherSource.Subscription s)
Description copied from interface:PublisherSource.Subscriber
Callback to receive aPublisherSource.Subscription
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onSubscribe
in interfacePublisherSource.Subscriber<T>
- Parameters:
s
-PublisherSource.Subscription
for thisSubscriber
.
-
onNext
public void onNext(T t)
Description copied from interface:PublisherSource.Subscriber
Callback to receive adata
element for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onNext
in interfacePublisherSource.Subscriber<T>
- Parameters:
t
- Adata
element.
-
onError
public void onError(java.lang.Throwable t)
Description copied from interface:PublisherSource.Subscriber
Callback to receive anerror
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onError
in interfacePublisherSource.Subscriber<T>
- Parameters:
t
-error
for thisSubscriber
.
-
onComplete
public void onComplete()
Description copied from interface:PublisherSource.Subscriber
Callback to signal completion of thePublisherSource
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onComplete
in interfacePublisherSource.Subscriber<T>
-
-