SinkRef

org.apache.pekko.stream.SinkRef
See theSinkRef companion object

A SinkRef allows sharing a "reference" to a Sink with others, with the main purpose of crossing a network boundary. Usually obtaining a SinkRef would be done via Actor messaging, in which one system asks a remote one, to accept some data from it, and the remote one decides to accept the request to send data in a back-pressured streaming fashion -- using a sink ref.

To create a SinkRef you have to materialize the Sink that you want to obtain a reference to by attaching it to a StreamRefs.sinkRef().

Stream refs can be seen as Reactive Streams over network boundaries. See also pekko.stream.SourceRef which is the dual of a SinkRef.

For additional configuration see reference.conf as well as pekko.stream.StreamRefAttributes.

Not for user extension.

Attributes

Companion
object
Source
StreamRefs.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Inherited types

type Shape = SinkShape[In]
Implicitly added by convertRefToSink

Type-level accessor for the shape parameter of this graph.

Type-level accessor for the shape parameter of this graph.

Attributes

Inherited from:
Graph
Source
Graph.scala

Value members

Abstract methods

def sink(): Sink[In, NotUsed]

Scala API: Get Sink underlying to this source ref.

Scala API: Get Sink underlying to this source ref.

Attributes

Source
StreamRefs.scala

Concrete methods

def asJava[JIn <: In]: Sink[JIn, Mat]
Implicitly added by convertRefToSink

Converts this Scala DSL element to it's Java DSL counterpart.

Converts this Scala DSL element to it's Java DSL counterpart.

Attributes

Source
Sink.scala
def contramap[In2](f: In2 => In): Sink[In2, Mat]
Implicitly added by convertRefToSink

Transform this Sink by applying a function to each incoming upstream element before it is passed to the Sink

Transform this Sink by applying a function to each incoming upstream element before it is passed to the Sink

'''Backpressures when''' original Sink backpressures

'''Cancels when''' original Sink cancels

Attributes

Source
Sink.scala
final def getSink(): Sink[In, NotUsed]

Java API: Get javadsl.Sink underlying to this source ref.

Java API: Get javadsl.Sink underlying to this source ref.

Attributes

Source
StreamRefs.scala
def mapMaterializedValue[Mat2](f: Mat => Mat2): Sink[In, Mat2]
Implicitly added by convertRefToSink

Transform only the materialized value of this Sink, leaving all other properties as they were.

Transform only the materialized value of this Sink, leaving all other properties as they were.

Attributes

Source
Sink.scala
def preMaterialize()(implicit materializer: Materializer): (Mat, Sink[In, NotUsed])
Implicitly added by convertRefToSink

Materializes this Sink, immediately returning (1) its materialized value, and (2) a new Sink that can be consume elements 'into' the pre-materialized one.

Materializes this Sink, immediately returning (1) its materialized value, and (2) a new Sink that can be consume elements 'into' the pre-materialized one.

Useful for when you need a materialized value of a Sink when handing it out to someone to materialize it for you.

Attributes

Source
Sink.scala
def runWith[Mat2](source: Graph[SourceShape[In], Mat2])(implicit materializer: Materializer): Mat2
Implicitly added by convertRefToSink

Connect this Sink to a Source and run it. The returned value is the materialized value of the Source, e.g. the Subscriber of a Source#subscriber.

Connect this Sink to a Source and run it. The returned value is the materialized value of the Source, e.g. the Subscriber of a Source#subscriber.

Note that the ActorSystem can be used as the implicit materializer parameter to use the pekko.stream.SystemMaterializer for running the stream.

Attributes

Source
Sink.scala

Concrete fields

override val shape: SinkShape[In]
Implicitly added by convertRefToSink

The shape of a graph is all that is externally visible: its inlets and outlets.

The shape of a graph is all that is externally visible: its inlets and outlets.

Attributes

Source
Sink.scala
override val traversalBuilder: LinearTraversalBuilder
Implicitly added by convertRefToSink

INTERNAL API.

INTERNAL API.

Every materializable element must be backed by a stream layout module

Attributes

Source
Sink.scala