Interface PgChannel
- All Superinterfaces:
ReadStream<String>, StreamBase
A channel to Postgres that tracks the subscription to a given Postgres channel using the
LISTEN/UNLISTEN commands.
When paused the channel discards the messages.-
Method Summary
Modifier and TypeMethodDescriptionendHandler(Handler<Void> endHandler) Set an handler to be called when no more notifications will be received.exceptionHandler(Handler<Throwable> handler) Inherited fromReadStream.exceptionHandler(Handler)but this one is a no-op.Set or unset an handler to be called when a the channel is notified by Postgres.pause()Pause the channel, all notifications are discarded.resume()Resume the channel.subscribeHandler(Handler<Void> handler) Set an handler called when the the channel get subscribed.Methods inherited from interface ReadStream
blockingStream, collect, fetch, pipe, pipeTo
-
Method Details
-
subscribeHandler
-
handler
Set or unset an handler to be called when a the channel is notified by Postgres.- when the handler is set, the subscriber sends a
LISTENcommand if needed - when the handler is unset, the subscriber sends a
UNLISTENcommand if needed
- Specified by:
handlerin interfaceReadStream<String>- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
- when the handler is set, the subscriber sends a
-
pause
PgChannel pause()Pause the channel, all notifications are discarded.- Specified by:
pausein interfaceReadStream<String>- Returns:
- a reference to this, so the API can be used fluently
-
resume
PgChannel resume()Resume the channel.- Specified by:
resumein interfaceReadStream<String>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
Set an handler to be called when no more notifications will be received.- Specified by:
endHandlerin interfaceReadStream<String>- Parameters:
endHandler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
Inherited fromReadStream.exceptionHandler(Handler)but this one is a no-op.- Specified by:
exceptionHandlerin interfaceReadStream<String>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-