Class PgChannel

java.lang.Object
io.vertx.rxjava3.pgclient.pubsub.PgChannel
All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate, ReadStream<String>, StreamBase

public class PgChannel extends Object implements io.vertx.lang.rx.RxDelegate, 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 Details

    • __TYPE_ARG

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

    • PgChannel

      public PgChannel(PgChannel delegate)
    • PgChannel

      public PgChannel(Object delegate)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public PgChannel getDelegate()
      Specified by:
      getDelegate in interface ReadStream<String>
      Specified by:
      getDelegate in interface io.vertx.lang.rx.RxDelegate
      Specified by:
      getDelegate in interface StreamBase
    • toObservable

      public Observable<String> toObservable()
      Specified by:
      toObservable in interface ReadStream<String>
    • toFlowable

      public Flowable<String> toFlowable()
      Specified by:
      toFlowable in interface ReadStream<String>
    • 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 Completable 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
    • exceptionHandler

      public PgChannel exceptionHandler(Handler<Throwable> handler)
      Inherited from but this one is a no-op.
      Specified by:
      exceptionHandler in interface ReadStream<String>
      Specified by:
      exceptionHandler in interface StreamBase
      Parameters:
      handler -
      Returns:
      a reference to this, so the API can be used fluently
    • newInstance

      public static PgChannel newInstance(PgChannel arg)