Package io.vertx.rxjava.pgclient.pubsub
Class PgChannel
- java.lang.Object
-
- io.vertx.rxjava.pgclient.pubsub.PgChannel
-
- All Implemented Interfaces:
ReadStream<String>,StreamBase
public class PgChannel extends Object implements ReadStream<String>
A channel to Postgres that tracks the subscription to a given Postgres channel using theLISTEN/UNLISTENcommands. When paused the channel discards the messages. NOTE: This class has been automatically generated from theoriginalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<PgChannel>__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PgChannelendHandler(Handler<Void> endHandler)Set an handler to be called when no more notifications will be received.booleanequals(Object o)PgChannelexceptionHandler(Handler<Throwable> handler)Set an exception handler on the read stream.ReadStream<String>fetch(long amount)Fetch the specifiedamountof elements.PgChannelgetDelegate()PgChannelhandler(Handler<String> handler)Set or unset an handler to be called when a the channel is notified by Postgres.inthashCode()static PgChannelnewInstance(PgChannel arg)PgChannelpause()Pause the channel, all notifications are discarded.Pipe<String>pipe()Pause this stream and return a to transfer the elements of this stream to a destination .voidpipeTo(WriteStream<String> dst)Pipe thisReadStreamto theWriteStream.voidpipeTo(WriteStream<String> dst, Handler<AsyncResult<Void>> handler)Pipe thisReadStreamto theWriteStream.PgChannelresume()Resume the channel.rx.Single<Void>rxPipeTo(WriteStream<String> dst)Pipe thisReadStreamto theWriteStream.PgChannelsubscribeHandler(Handler<Void> handler)Set an handler called when the the channel get subscribed.rx.Observable<String>toObservable()StringtoString()
-
-
-
Method Detail
-
getDelegate
public PgChannel getDelegate()
- Specified by:
getDelegatein interfaceReadStream<String>- Specified by:
getDelegatein interfaceStreamBase
-
toObservable
public rx.Observable<String> toObservable()
- Specified by:
toObservablein interfaceReadStream<String>
-
fetch
public ReadStream<String> fetch(long amount)
Fetch the specifiedamountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand.- Specified by:
fetchin interfaceReadStream<String>- Parameters:
amount-- Returns:
- a reference to this, so the API can be used fluently
-
pipe
public Pipe<String> pipe()
Pause this stream and return a to transfer the elements of this stream to a destination . The stream will be resumed when the pipe will be wired to aWriteStream.- Specified by:
pipein interfaceReadStream<String>- Returns:
- a pipe
-
pipeTo
public void pipeTo(WriteStream<String> dst, Handler<AsyncResult<Void>> handler)
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handlerwill be called with the result.- Specified by:
pipeToin interfaceReadStream<String>- Parameters:
dst- the destination write streamhandler-
-
pipeTo
public void pipeTo(WriteStream<String> dst)
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handlerwill be called with the result.- Specified by:
pipeToin interfaceReadStream<String>- Parameters:
dst- the destination write stream
-
rxPipeTo
public rx.Single<Void> rxPipeTo(WriteStream<String> dst)
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handlerwill be called with the result.- Specified by:
rxPipeToin interfaceReadStream<String>- Parameters:
dst- the destination write stream- Returns:
-
subscribeHandler
public 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
public 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
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
public 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
public PgChannel resume()
Resume the channel.- Specified by:
resumein interfaceReadStream<String>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public PgChannel endHandler(Handler<Void> 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
public PgChannel exceptionHandler(Handler<Throwable> handler)
Description copied from interface:ReadStreamSet an exception handler on the read stream.- 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
-
-