public class GraphStageLogic.SubSourceOutlet<T>
extends java.lang.Object
This allows the dynamic creation of an Outlet for a GraphStage which is
connected to a Source that is available for materialization (e.g. using
the subFusingMaterializer
). Care needs to be taken to complete this
Outlet when the stage shuts down lest the corresponding Sink be left
hanging. It is good practice to use the timeout
method to cancel this
Outlet in case the corresponding Source is not materialized within a
given time limit, see e.g. ActorMaterializerSettings.
Constructor and Description |
---|
SubSourceOutlet(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
complete()
Complete this output port.
|
void |
fail(java.lang.Throwable ex)
Fail this output port.
|
boolean |
isAvailable()
Returns
true if this output port can be pushed. |
boolean |
isClosed()
Returns
true if this output port is closed, but caution
THIS WORKS DIFFERENTLY THAN THE NORMAL isClosed(out). |
void |
push(T elem)
Push to this output port.
|
void |
setHandler(OutHandler handler)
Set OutHandler for this dynamic output port; this needs to be done before
the first substream callback can arrive.
|
Graph<SourceShape<T>,NotUsed> |
source()
Get the Source for this dynamic output port.
|
void |
timeout(scala.concurrent.duration.FiniteDuration d)
Set the source into timed-out mode if it has not yet been materialized.
|
java.lang.String |
toString() |
public void timeout(scala.concurrent.duration.FiniteDuration d)
d
- (undocumented)public Graph<SourceShape<T>,NotUsed> source()
public void setHandler(OutHandler handler)
handler
- (undocumented)public boolean isAvailable()
true
if this output port can be pushed.public boolean isClosed()
true
if this output port is closed, but caution
THIS WORKS DIFFERENTLY THAN THE NORMAL isClosed(out).
Due to possibly asynchronous shutdown it may not return
true
immediately after complete()
or fail()
have returned.public void push(T elem)
elem
- (undocumented)public void complete()
public void fail(java.lang.Throwable ex)
ex
- (undocumented)public java.lang.String toString()
toString
in class java.lang.Object