private def runningCommandHandler()

in pekko-sample-persistence-dc-scala/src/main/scala/sample/persistence/res/auction/Auction.scala [73:95]


  private def runningCommandHandler(state: AuctionState, command: Command): Effect[Event, AuctionState] =
    command match {
      case OfferBid(bidder, offer) =>
        Effect.persist(
          BidRegistered(
            Bid(
              bidder,
              offer,
              Instant.ofEpochMilli(replicationContext.currentTimeMillis()),
              replicationContext.replicaId)))
      case GetHighestBid(replyTo) =>
        replyTo ! state.highestBid
        Effect.none
      case Finish =>
        Effect.persist(AuctionFinished(replicationContext.replicaId))
      case Close =>
        context.log.warn("Premature close")
        // Close should only be triggered when we have already finished
        Effect.unhandled
      case IsClosed(replyTo) =>
        replyTo ! false
        Effect.none
    }