Akka Serverless Java/Scala 0.9.0 released

We are excited to release Akka Serverless Java/Scala SDK version 0.9.0.

It includes a feature complete Scala SDK. Here is an example of an Event Sourced Entity:

class ShoppingCart(context: EventSourcedEntityContext) extends AbstractShoppingCart {

  private val entityId = context.entityId

  override def emptyState: Cart = Cart.defaultInstance

  override def addItem(currentState: Cart, addLineItem: AddLineItem): EventSourcedEntity.Effect[Empty] =
    if (addLineItem.quantity <= 0)
      effects.error(s"Quantity for item ${addLineItem.productId} must be greater than zero.")
    else {
      val event = ItemAdded(
          productId = addLineItem.productId,
          name = addLineItem.name,
          quantity = addLineItem.quantity))
        .thenReply(_ => Empty.defaultInstance)

  override def itemAdded(currentState: Cart, itemAdded: ItemAdded): Cart = {
    val cart = currentState.items.map(lineItem => lineItem.productId -> lineItem).toMap
    val item = cart.get(itemAdded.getItem.productId) match {
      case Some(existing) => existing.copy(quantity = existing.quantity + itemAdded.getItem.quantity)
      case None => itemAdded.getItem
    val updatedCart = cart + (item.productId -> item)

You find the documentation at Developing with Java or Scala :: Akka Serverless Documentation

Also, note the new Quickstart for Views.


Thanks! This is great news!

And I love that I read the code and it made sense to me. My early days of scala learning are beginning to pay off!

Great new mini tutorial from @mckeeh3 on bootstrapping a serverless Java project in just 13min (using this SDK version)!