concept update in category akka
appears as: updates, updates, n update, update, The update, update

This is an excerpt from Manning's book Reactive Design Patterns.
Active–passive replication— Replicas agree on which one of them can accept updates. Fail-over to a different replica requires consensus among the remaining ones when the active replica no longer responds.
High availability (A) of that data (for updates)
Listing 13.6. Consolidation: applying updates that were held previously
private val matches = (p: (Int, Int)) => p._1 == p._2 private def consolidate(theStore: Map[String, JsValue], expectedSeq: Int, askedFor: Set[Int], waiting: TreeMap[Int, Replicate]): Unit = { val prefix = waiting.keysIterator .zip(Iterator from expectedSeq) .takeWhile(matches) .size #1 val nextStore = waiting.valuesIterator .take(prefix) .foldLeft(theStore) { (store, replicate) => persist(name, replicate.seq, theStore) replicate.replyTo ! Replicated(replicate.seq) applied.enqueue(replicate) store + (replicate.key -> replicate.value) } val nextWaiting = waiting.drop(prefix) val nextExpectedSeq = expectedSeq + prefix applied.drop(Math.max(0, applied.size - maxLag)) #2 if (nextWaiting.nonEmpty) { if (nextWaiting.lastKey - nextExpectedSeq > maxLag) #3 fallBehind(nextExpectedSeq, nextWaiting) else missingSomeUpdates(nextStore, nextExpectedSeq, askedFor, nextWaiting) } else caughtUp(nextStore, nextExpectedSeq) } #1 - Calculates the length of the directly applicable queue prefix #2 - Caps the size of the applied buffer #3 - Checks whether you fell behind too much

This is an excerpt from Manning's book Akka in Action.
Listing 8.11. Routing messages
case class RouteSlipMessage(routeSlip: Seq[ActorRef], #1 message: AnyRef) trait RouteSlip { def sendMessageToNextTask(routeSlip: Seq[ActorRef], message: AnyRef): Unit = { val nextTask = routeSlip.head #2 val newSlip = routeSlip.tail if (newSlip.isEmpty) { #3 nextTask ! message } else { nextTask ! RouteSlipMessage( #4 routeSlip = newSlip, message = message) } } } #1 - Actual message that’s sent between the tasks #2 - Gets next step #3 - Sends actual message without the routing slip at last step #4 - Sends message to next step and updates routing slip !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[]"} !@%STYLE%@!