| Constructor and Description |
|---|
EventPublisher(ExecutorService executorService) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
process(JsonRpcEvent event)
This method is used by @link
ResponseWorker to submit an @link JsonRpcEvent for processing. |
void |
publish(String subscriptionId,
Map<String,Object> params)
Request
Publisher to send data. |
void |
subscribe(EventSubscriber subscriber)
Request
Publisher to start streaming data. |
public EventPublisher(ExecutorService executorService)
public void subscribe(EventSubscriber subscriber)
PublisherPublisher to start streaming data.
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single Subscriber.
A Subscriber should only subscribe once to a single Publisher.
If the Publisher rejects the subscription attempt or otherwise fails it will
signal the error via Subscriber.onError(java.lang.Throwable).
subscribe in interface Publisher<Map<String,Object>,EventSubscriber>subscriber - the Subscriber that will consume signals from this Publisherpublic void publish(String subscriptionId, Map<String,Object> params) throws IOException
PublisherPublisher to send data.publish in interface Publisher<Map<String,Object>,EventSubscriber>subscriptionId - the identifier for Subscriber who will consume the eventparams - the data that needs to be sent to the SubscriberIOException - an exception is thrown if the params cannot be serializedpublic void process(JsonRpcEvent event)
ResponseWorker to submit an @link JsonRpcEvent for processing.event - which is submitted for processing.public void close()
Copyright © 2018. All Rights Reserved.