class PgSubscriber extends AnyRef
A class for managing subscriptions using LISTEN/UNLISTEN to Postgres channels.
The subscriber manages a single connection to Postgres.
- Alphabetic
- By Inheritance
- PgSubscriber
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new PgSubscriber(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
actualConnection(): PgConnection
- returns
the actual connection to Postgres, it might be
null
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
channel(name: String): PgChannel
Return a channel for the given
name.Return a channel for the given
name. * @param name the channel nameThis will be the name of the channel exactly as held by Postgres for sending notifications. Internally this name will be truncated to the Postgres identifier maxiumum length of
(NAMEDATALEN = 64) - 1 == 63characters, and prepared as a quoted identifier without unicode escape sequence support for use inLISTEN/UNLISTENcommands. Examples of channel names and correspondingNOTIFYcommands:- when
name == "the_channel":NOTIFY the_channel, 'msg',NOTIFY The_Channel, 'msg', orNOTIFY "the_channel", 'msg'succeed in delivering a message to the created channel - when
name == "The_Channel":NOTIFY "The_Channel", 'msg', succeeds in delivering a message to the created channel -
- returns
the channel
- when
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(): Unit
Close the subscriber, the retry policy will not be invoked.
-
def
closeHandler(handler: Handler[Unit]): PgSubscriber
Set an handler called when the subscriber is closed.
Set an handler called when the subscriber is closed. * @param handler the handler
- returns
a reference to this, so the API can be used fluently
-
def
closed(): Boolean
- returns
whether the subscriber is closed
-
def
connect(handler: Handler[AsyncResult[Unit]]): PgSubscriber
Connect the subscriber to Postgres.
Connect the subscriber to Postgres. * @param handler the handler notified of the connection success or failure
- returns
a reference to this, so the API can be used fluently
-
def
connectFuture(): Future[Unit]
Like connect but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
reconnectPolicy(policy: (Int) ⇒ Long): PgSubscriber
Set the reconnect policy that is executed when the subscriber is disconnected.
Set the reconnect policy that is executed when the subscriber is disconnected.
When the subscriber is disconnected, the
policyfunction is called with the actual number of retries and returns anamountOfTimevalue:- when
amountOfTime < 0: the subscriber is closed and there is no retry - when
amountOfTime == 0: the subscriber retries to connect immediately - when
amountOfTime > 0: the subscriber retries afteramountOfTimemilliseconds
The default policy does not perform any retries. * @param policy the policy to set
- returns
a reference to this, so the API can be used fluently
- when
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )