Class 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 the LISTEN/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 Detail

      • __TYPE_ARG

        public static final io.vertx.lang.rx.TypeArg<PgChannel> __TYPE_ARG
    • Constructor Detail

      • PgChannel

        public PgChannel​(PgChannel delegate)
      • PgChannel

        public PgChannel​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • fetch

        public ReadStream<String> fetch​(long amount)
        Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.
        Specified by:
        fetch in interface ReadStream<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 a WriteStream.

        Specified by:
        pipe in interface ReadStream<String>
        Returns:
        a pipe
      • pipeTo

        public Future<Void> pipeTo​(WriteStream<String> dst)
        Pipe this ReadStream to the WriteStream.

        Elements emitted by this stream will be written to the write stream until this stream ends or fails.

        Specified by:
        pipeTo in interface ReadStream<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 this ReadStream to the WriteStream.

        Elements emitted by this stream will be written to the write stream until this stream ends or fails.

        Specified by:
        rxPipeTo in interface ReadStream<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 interface ReadStream<String>
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • pause

        public PgChannel pause()
        Pause the channel, all notifications are discarded.
        Specified by:
        pause in interface ReadStream<String>
        Returns:
        a reference to this, so the API can be used fluently
      • resume

        public PgChannel resume()
        Resume the channel.
        Specified by:
        resume in interface ReadStream<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 interface ReadStream<String>
        Parameters:
        endHandler - the handler
        Returns:
        a reference to this, so the API can be used fluently