abstract class AckSourceLogic[T <: AcknowledgeContext] extends TimerGraphStageLogic
Provide common logic for Source stages producing FlowEnvelopes requiring acknowledgement handling.
The AckSource logic encapsulates the underlying logic for an arbitrary Source of FlowEnvelopes. The envelopes will be passed down stream and must be acknowledged or denied eventually. An acknowledgement that takes too long, will be treated as a denial as well.
A concrete implementation must implement the actions to be executed upon acknowledgement and denial. For example, a JMS source would use a JMS acknowledge on the underlying JMS message and a session.recover() upon a denial. A file system based source may move or delete the original file upon acknowledge and restore the original file upon denial.
After picking up an envelope from an external system, the envelope will be considered to be inflight until either an acknowledge or deny has been called. The AckSource logic defines the maximum number of messages that can be inflight at any moment in time. No further messages will be pulled from the external system until a free inflight slot will become available.
Concrete implementations must:
- create and maintain any technical connections required to poll the external system - map the inbound data to a FlowEnvelope - implement the concrete actions for acknowledgement and denial
We will use an AcknowledgeContext to hold an inflight envelope and the id of the inflight slot it is using along with any additional that might be required to perform an acknowledge or denial.
As a result, each poll of the external system will produce an Option[AcknowledgeContext] which will then be inserted into a free inflight slot. As a consequence, polling of the external system will only be performed if and only if a free inflight slot is available.
As long as free inflight slots are available and no external messages are available, the poll will be executed \in regular intervals. Concrete implementations may overwrite the the nextPoll() method to modify the calculation of the next polling occurrence.
- Alphabetic
- By Inheritance
- AckSourceLogic
- TimerGraphStageLogic
- GraphStageLogic
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new AckSourceLogic(shape: Shape, out: Outlet[FlowEnvelope], ackTimeout: FiniteDuration)
Type Members
Abstract Value Members
- abstract def doPerformPoll(id: String, ackHandler: AcknowledgeHandler): Try[Option[T]]
- Attributes
- protected
- abstract val id: String
The id to identify the instance in the log files
The id to identify the instance in the log files
- Attributes
- protected
- abstract val inflightSlots: List[String]
The id's of the available inflight slots
The id's of the available inflight slots
- Attributes
- protected
- abstract def log: FlowEnvelopeLogger
A logger that must be defined by concrete implementations
A logger that must be defined by concrete implementations
- Attributes
- protected
Concrete 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
- final def abortEmitting(out: Outlet[_]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def abortReading(in: Inlet[_]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- def ackTimedOut(ackCtxt: T): Unit
- Attributes
- protected
- val ackTimeout: FiniteDuration
- def afterPostStop(): Unit
- Attributes
- protected[stream]
- Definition Classes
- TimerGraphStageLogic → GraphStageLogic
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val autoAcknowledge: Boolean
- Attributes
- protected
- def beforePreStart(): Unit
- Attributes
- protected[stream]
- Definition Classes
- GraphStageLogic
- final def cancel[T](in: Inlet[T], cause: Throwable): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def cancel[T](in: Inlet[T]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def cancelStage(cause: Throwable): Unit
- Definition Classes
- GraphStageLogic
- final def cancelTimer(timerKey: Any): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def complete[T](out: Outlet[T]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def completeStage(): Unit
- Definition Classes
- GraphStageLogic
- final def conditionalTerminateInput(predicate: () => Boolean): InHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def conditionalTerminateOutput(predicate: () => Boolean): OutHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def createAsyncCallback[T](handler: Procedure[T]): AsyncCallback[T]
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- def determineNextSlot(slotList: List[String]): Option[String]
- Attributes
- protected
- final def eagerTerminateInput: InHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def eagerTerminateOutput: OutHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emit[T](out: Outlet[T], elem: T, andThen: Effect): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emit[T](out: Outlet[T], elem: T): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emit[T](out: Outlet[T], elem: T, andThen: () => Unit): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emitMultiple[T](out: Outlet[T], elems: Iterator[T]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emitMultiple[T](out: Outlet[T], elems: Iterator[T], andThen: () => Unit): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emitMultiple[T](out: Outlet[T], elems: Iterator[T], andThen: Effect): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emitMultiple[T](out: Outlet[T], elems: Iterator[T]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emitMultiple[T](out: Outlet[T], elems: Iterable[T]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def emitMultiple[T](out: Outlet[T], elems: Iterable[T], andThen: () => Unit): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def fail[T](out: Outlet[T], ex: Throwable): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- val fail: AsyncCallback[Throwable]
- Attributes
- protected
- final def failStage(ex: Throwable): Unit
- Definition Classes
- GraphStageLogic
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def freeInflightSlot(): Option[String]
- Attributes
- protected
- final def getAsyncCallback[T](handler: (T) => Unit): AsyncCallback[T]
- Definition Classes
- GraphStageLogic
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getEagerStageActor(eagerMaterializer: Materializer, poisonPillCompatibility: Boolean)(receive: ((ActorRef, Any)) => Unit): StageActor
- Attributes
- protected[akka]
- Definition Classes
- GraphStageLogic
- Annotations
- @InternalApi()
- final def getHandler(out: Outlet[_]): OutHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def getHandler(in: Inlet[_]): InHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def getStageActor(receive: ((ActorRef, Any)) => Unit): StageActor
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def grab[T](in: Inlet[T]): T
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def hasBeenPulled[T](in: Inlet[T]): Boolean
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def ignoreTerminateInput: InHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def ignoreTerminateOutput: OutHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- val inCount: Int
- Definition Classes
- GraphStageLogic
- final def isAvailable[T](out: Outlet[T]): Boolean
- Definition Classes
- GraphStageLogic
- final def isAvailable[T](in: Inlet[T]): Boolean
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def isClosed[T](out: Outlet[T]): Boolean
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def isClosed[T](in: Inlet[T]): Boolean
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def isTimerActive(timerKey: Any): Boolean
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- def materializer: Materializer
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nextPoll(): Option[FiniteDuration]
- Attributes
- protected
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def onTimer(timerKey: Any): Unit
- Attributes
- protected
- Definition Classes
- AckSourceLogic → TimerGraphStageLogic
- val out: Outlet[FlowEnvelope]
- val outCount: Int
- Definition Classes
- GraphStageLogic
- final def passAlong[Out, In <: Out](from: Inlet[In], to: Outlet[Out], doFinish: Boolean, doFail: Boolean, doPull: Boolean): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- def pending(): Map[String, T]
- Attributes
- protected
- def poll(): Unit
Poll the external system whether a new message is available.
Poll the external system whether a new message is available. If a message can be polled without any exceptions, the resulting envelope will be wrapped in an AcknowledgeContext and returned. If no message is available, the result will be Success(None) * Any exception while polling for a message will deny all remaining inflight messages and then fail the stage.
- Attributes
- protected
- val pollImmediately: AsyncCallback[Unit]
- Attributes
- protected
- def postStop(): Unit
- Definition Classes
- AckSourceLogic → GraphStageLogic
- def preStart(): Unit
- Definition Classes
- AckSourceLogic → GraphStageLogic
- final def pull[T](in: Inlet[T]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def push[T](out: Outlet[T], elem: T): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def read[T](in: Inlet[T], andThen: Procedure[T], onClose: Effect): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def read[T](in: Inlet[T])(andThen: (T) => Unit, onClose: () => Unit): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def readN[T](in: Inlet[T], n: Int, andThen: Procedure[List[T]], onClose: Procedure[List[T]]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def readN[T](in: Inlet[T], n: Int)(andThen: (Seq[T]) => Unit, onClose: (Seq[T]) => Unit): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def scheduleAtFixedRate(timerKey: Any, initialDelay: Duration, interval: Duration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- final def scheduleAtFixedRate(timerKey: Any, initialDelay: FiniteDuration, interval: FiniteDuration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- final def scheduleOnce(timerKey: Any, delay: Duration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- final def scheduleOnce(timerKey: Any, delay: FiniteDuration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- final def scheduleWithFixedDelay(timerKey: Any, initialDelay: Duration, interval: Duration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- final def scheduleWithFixedDelay(timerKey: Any, initialDelay: FiniteDuration, delay: FiniteDuration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- final def setHandler(out: Outlet[_], handler: OutHandler): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def setHandler(in: Inlet[_], handler: InHandler): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def setHandlers(in: Inlet[_], out: Outlet[_], handler: InHandler with OutHandler): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def setKeepGoing(enabled: Boolean): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- val shape: Shape
- final def stageActor: StageActor
- Definition Classes
- GraphStageLogic
- def stageActorName: String
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- def subFusingMaterializer: Materializer
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def totallyIgnorantInput: InHandler
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- final def tryPull[T](in: Inlet[T]): Unit
- Attributes
- protected
- Definition Classes
- GraphStageLogic
- val updateAckState: AsyncCallback[(String, AckState)]
- Attributes
- protected
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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()
Deprecated Value Members
- final def schedulePeriodically(timerKey: Any, interval: Duration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.
- final def schedulePeriodically(timerKey: Any, interval: FiniteDuration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.
- final def schedulePeriodicallyWithInitialDelay(timerKey: Any, initialDelay: Duration, interval: Duration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.
- final def schedulePeriodicallyWithInitialDelay(timerKey: Any, initialDelay: FiniteDuration, interval: FiniteDuration): Unit
- Attributes
- protected
- Definition Classes
- TimerGraphStageLogic
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.