Package io.vertx.pgclient.pubsub
Interface PgChannel
-
- All Superinterfaces:
ReadStream<String>
,StreamBase
public interface PgChannel extends ReadStream<String>
A channel to Postgres that tracks the subscription to a given Postgres channel using theLISTEN/UNLISTEN
commands. When paused the channel discards the messages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PgChannel
endHandler(Handler<Void> endHandler)
Set an handler to be called when no more notifications will be received.PgChannel
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.PgChannel
handler(Handler<String> handler)
Set or unset an handler to be called when a the channel is notified by Postgres.PgChannel
pause()
Pause the channel, all notifications are discarded.PgChannel
resume()
Resume the channel.PgChannel
subscribeHandler(Handler<Void> handler)
Set an handler called when the the channel get subscribed.-
Methods inherited from interface io.vertx.core.streams.ReadStream
collect, fetch, pipe, pipeTo
-
-
-
-
Method Detail
-
subscribeHandler
PgChannel subscribeHandler(Handler<Void> handler)
Set an handler called when the the channel get subscribed.- Parameters:
handler
- the handler- Returns:
- a reference to this, so the API can be used fluently
-
handler
PgChannel handler(Handler<String> 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
LISTEN
command if needed - when the handler is unset, the subscriber sends a
UNLISTEN
command if needed
- Specified by:
handler
in 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:
pause
in interfaceReadStream<String>
- Returns:
- a reference to this, so the API can be used fluently
-
resume
PgChannel resume()
Resume the channel.- Specified by:
resume
in interfaceReadStream<String>
- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
PgChannel endHandler(Handler<Void> endHandler)
Set an handler to be called when no more notifications will be received.- Specified by:
endHandler
in interfaceReadStream<String>
- Parameters:
endHandler
- the handler- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
PgChannel exceptionHandler(Handler<Throwable> handler)
Description copied from interface:ReadStream
Set an exception handler on the read stream.- Specified by:
exceptionHandler
in interfaceReadStream<String>
- Specified by:
exceptionHandler
in interfaceStreamBase
- Parameters:
handler
- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
-