final class PubSubRef[T] extends NoSerializationVerificationNeeded
A PubSubRef
represents a publish/subscribe topic.
Messages can be published to the topic via a stream by using the Source
returned by the #publisher method. A single message can be published
with the #publish method.
Messages can be consumed from the topic via a stream by using the Sink
returned by the #subscriber method.
The registry of subscribers is eventually consistent, i.e. new subscribers are not immediately visible at other nodes, but typically the information will be fully replicated to all other nodes after a few seconds.
New subscribers will not see old messages that were published to the topic, i.e. it is only a live stream of messages.
Messages are not guaranteed to be delivered, i.e. they may be lost. That can for example happen if there is a transient network partition.
The subscriber has a buffer of received messages, but messages will be dropped if that buffer is full and demand for more elements have not been requested from downstream. This can happen if a subscriber is slower than the publishers of the messages. When the buffer is full the oldest messages are dropped to make room for new messages.
- Source
- PubSubRef.scala
- Alphabetic
- By Inheritance
- PubSubRef
- NoSerializationVerificationNeeded
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (PubSubRef[T], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def ensuring(cond: (PubSubRef[T]) ⇒ Boolean, msg: ⇒ Any): PubSubRef[T]
- def ensuring(cond: (PubSubRef[T]) ⇒ Boolean): PubSubRef[T]
- def ensuring(cond: Boolean, msg: ⇒ Any): PubSubRef[T]
- def ensuring(cond: Boolean): PubSubRef[T]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hasAnySubscribers(): Future[Boolean]
Request if this topic has any known subscribers at this point.
Request if this topic has any known subscribers at this point. The
Future
is completed with the currently known information at this node, i.e. completion is not deferred until there are subscribers.Note that the registry of subscribers is eventually consistent, i.e. new subscribers are not immediately visible at other nodes, but typically the information will be fully replicated to all other nodes after a few seconds.
This method is especially useful when writing tests that require that a subscriber is known before sending messages to a topic.
-
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 publish(message: T): Unit
-
def
publisher: Sink[T, NotUsed]
Publish messages from a stream to the topic.
Publish messages from a stream to the topic. You have to connect a
Source
that produces the messages to thisSink
and thenrun
the stream. -
def
subscriber: Source[T, NotUsed]
Consume messages from the topic via a stream.
Consume messages from the topic via a stream. You can return this
Source
as a response in aServiceCall
and the elements will be streamed to the client. Otherwise you have to connect aSink
that consumes the messages from thisSource
and thenrun
the stream. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- PubSubRef → AnyRef → Any
- val topic: TopicId[T]
-
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
- @throws( ... ) @native()
-
def
writeReplace(): AnyRef
- Attributes
- protected
- Annotations
- @throws( ... )
- def →[B](y: B): (PubSubRef[T], B)