Class PgChannel
- java.lang.Object
-
- io.vertx.reactivex.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/UNLISTEN
commands. When paused the channel discards the messages.NOTE: This class has been automatically generated from the
original
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<PgChannel>
__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PgChannel
endHandler(Handler<Void> endHandler)
Set an handler to be called when no more notifications will be received.boolean
equals(Object o)
PgChannel
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.ReadStream<String>
fetch(long amount)
Fetch the specifiedamount
of elements.PgChannel
getDelegate()
PgChannel
handler(Handler<String> handler)
Set or unset an handler to be called when a the channel is notified by Postgres.int
hashCode()
static PgChannel
newInstance(PgChannel arg)
PgChannel
pause()
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 .Future<Void>
pipeTo(WriteStream<String> dst)
Pipe thisReadStream
to theWriteStream
.PgChannel
resume()
Resume the channel.Completable
rxPipeTo(WriteStream<String> dst)
Pipe thisReadStream
to theWriteStream
.PgChannel
subscribeHandler(Handler<Void> handler)
Set an handler called when the the channel get subscribed.Flowable<String>
toFlowable()
Observable<String>
toObservable()
String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final io.vertx.lang.rx.TypeArg<PgChannel> __TYPE_ARG
-
-
Method Detail
-
getDelegate
public PgChannel getDelegate()
- Specified by:
getDelegate
in interfaceReadStream<String>
- Specified by:
getDelegate
in interfaceStreamBase
-
toObservable
public Observable<String> toObservable()
- Specified by:
toObservable
in interfaceReadStream<String>
-
toFlowable
public Flowable<String> toFlowable()
- Specified by:
toFlowable
in interfaceReadStream<String>
-
fetch
public ReadStream<String> fetch(long amount)
Fetch the specifiedamount
of elements. If theReadStream
has been paused, reading will recommence with the specifiedamount
of items, otherwise the specifiedamount
will be added to the current stream demand.- Specified by:
fetch
in 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:
pipe
in interfaceReadStream<String>
- Returns:
- a pipe
-
pipeTo
public Future<Void> pipeTo(WriteStream<String> dst)
Pipe thisReadStream
to theWriteStream
.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
- Specified by:
pipeTo
in interfaceReadStream<String>
- Parameters:
dst
- the destination write stream- Returns:
- a future notified when the write stream will be ended with the outcome
-
rxPipeTo
public Completable rxPipeTo(WriteStream<String> dst)
Pipe thisReadStream
to theWriteStream
.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
- Specified by:
rxPipeTo
in interfaceReadStream<String>
- Parameters:
dst
- the destination write stream- Returns:
- a future notified when the write stream will be ended with the outcome
-
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
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
public 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
public PgChannel resume()
Resume the channel.- Specified by:
resume
in 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:
endHandler
in 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: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
-
-