abstract class Materializer extends AnyRef
The Materializer is the component responsible for turning a stream blueprint into a running stream. In general the system wide materializer should be preferred over creating instances manually.
Not for user extension
- Annotations
- @implicitNotFound() @nowarn() @DoNotInherit()
- Source
- Materializer.scala
- Alphabetic
- By Inheritance
- Materializer
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Materializer()
Abstract Value Members
- implicit abstract def executionContext: ExecutionContextExecutor
Running a flow graph will require execution resources, as will computations within Sources, Sinks, etc.
Running a flow graph will require execution resources, as will computations within Sources, Sinks, etc. This scala.concurrent.ExecutionContextExecutor can be used by parts of the flow to submit processing jobs for execution, run Future callbacks, etc.
Note that this is not necessarily the same execution context the stream operator itself is running on.
- abstract def isShutdown: Boolean
Indicates if the materializer has been shut down.
- abstract def materialize[Mat](runnable: Graph[ClosedShape, Mat], defaultAttributes: Attributes): Mat
This method interprets the given Flow description and creates the running stream using an explicitly provided Attributes as top level (least specific) attributes that will be defaults for the materialized stream.
This method interprets the given Flow description and creates the running stream using an explicitly provided Attributes as top level (least specific) attributes that will be defaults for the materialized stream. The result can be highly implementation specific, ranging from local actor chains to remote-deployed processing networks.
- abstract def materialize[Mat](runnable: Graph[ClosedShape, Mat]): Mat
This method interprets the given Flow description and creates the running stream.
This method interprets the given Flow description and creates the running stream. The result can be highly implementation specific, ranging from local actor chains to remote-deployed processing networks.
- abstract def scheduleAtFixedRate(initialDelay: FiniteDuration, interval: FiniteDuration, task: Runnable): Cancellable
Interface for operators that need timer services for their functionality.
Interface for operators that need timer services for their functionality.
Schedules a
Runnable
to be run repeatedly with an initial delay and a frequency. E.g. if you would like the function to be run after 2 seconds and thereafter every 100ms you would setdelay=Duration(2, TimeUnit.SECONDS)
andinterval=Duration(100, TimeUnit.MILLISECONDS)
.It will compensate the delay for a subsequent task if the previous tasks took too long to execute. In such cases, the actual execution interval will differ from the interval passed to the method.
If the execution of the tasks takes longer than the
interval
, the subsequent execution will start immediately after the prior one completes (there will be no overlap of executions). This also has the consequence that after long garbage collection pauses or other reasons when the JVM was suspended all "missed" tasks will execute when the process wakes up again.In the long run, the frequency of execution will be exactly the reciprocal of the specified
interval
.Warning:
scheduleAtFixedRate
can result in bursts of scheduled tasks after long garbage collection pauses, which may in worst case cause undesired load on the system. ThereforescheduleWithFixedDelay
is often preferred.If the
Runnable
throws an exception the repeated scheduling is aborted, i.e. the function will not be invoked any more.- returns
A pekko.actor.Cancellable that allows cancelling the timer. Cancelling is best effort, if the event has been already enqueued it will not have an effect.
- Exceptions thrown
IllegalArgumentException
if the given delays exceed the maximum supported by theScheduler
.
- abstract def scheduleOnce(delay: FiniteDuration, task: Runnable): Cancellable
Interface for operators that need timer services for their functionality.
Interface for operators that need timer services for their functionality. Schedules a single task with the given delay.
- returns
A pekko.actor.Cancellable that allows cancelling the timer. Cancelling is best effort, if the event has been already enqueued it will not have an effect.
- abstract def scheduleWithFixedDelay(initialDelay: FiniteDuration, delay: FiniteDuration, task: Runnable): Cancellable
Interface for operators that need timer services for their functionality.
Interface for operators that need timer services for their functionality.
Schedules a
Runnable
to be run repeatedly with an initial delay and a fixeddelay
between subsequent executions.It will not compensate the delay between tasks if the execution takes a long time or if scheduling is delayed longer than specified for some reason. The delay between subsequent execution will always be (at least) the given
delay
. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specifieddelay
.If the
Runnable
throws an exception the repeated scheduling is aborted, i.e. the function will not be invoked any more.- returns
A pekko.actor.Cancellable that allows cancelling the timer. Cancelling is best effort, if the event has been already enqueued it will not have an effect.
- Exceptions thrown
IllegalArgumentException
if the given delays exceed the maximum supported by theScheduler
.
- abstract def shutdown(): Unit
Shuts down this materializer and all the operators that have been materialized through this materializer.
Shuts down this materializer and all the operators that have been materialized through this materializer. After having shut down, this materializer cannot be used again. Any attempt to materialize operators after having shut down will result in an IllegalStateException being thrown at materialization time.
- abstract def system: ActorSystem
The classic actor system this materializer is backed by (and in which the streams materialized with the materializer will run)
- abstract def withNamePrefix(name: String): Materializer
The
namePrefix
shall be used for deriving the names of processing entities that are created during materialization.The
namePrefix
shall be used for deriving the names of processing entities that are created during materialization. This is meant to aid logging and failure reporting both during materialization and while the stream is running. - abstract def schedulePeriodically(initialDelay: FiniteDuration, interval: FiniteDuration, task: Runnable): Cancellable
Interface for operators that need timer services for their functionality.
Interface for operators that need timer services for their functionality. Schedules a repeated task with the given interval between invocations.
- returns
A pekko.actor.Cancellable that allows cancelling the timer. Cancelling is best effort, if the event has been already enqueued it will not have an effect.
- Annotations
- @deprecated
- Deprecated
(Since version Akka 2.6.0) Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.
- abstract def settings: ActorMaterializerSettings
- Annotations
- @deprecated
- Deprecated
(Since version Akka 2.6.0) Use attributes to access settings from stages
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from Materializer toany2stringadd[Materializer] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (Materializer, B)
- Implicit
- This member is added by an implicit conversion from Materializer toArrowAssoc[Materializer] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- 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(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def ensuring(cond: (Materializer) => Boolean, msg: => Any): Materializer
- Implicit
- This member is added by an implicit conversion from Materializer toEnsuring[Materializer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (Materializer) => Boolean): Materializer
- Implicit
- This member is added by an implicit conversion from Materializer toEnsuring[Materializer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): Materializer
- Implicit
- This member is added by an implicit conversion from Materializer toEnsuring[Materializer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): Materializer
- Implicit
- This member is added by an implicit conversion from Materializer toEnsuring[Materializer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @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
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Materializer toStringFormat[Materializer] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (Materializer, B)
- Implicit
- This member is added by an implicit conversion from Materializer toArrowAssoc[Materializer] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.