super-flat / lagom-pb

Shared code for lagom using protocol buffer with some goodies.

GitHub

lagom-pb = lagom + protocol buffer

Build Status Codacy Badge License GitHub last commit Maven Central Snapshot Artifacts

Scala shared code for lagom development using protocol buffer.

This library helps write lagom microservices easily by making use of protocol buffer messages to define the es/cqrs core components like api requests/responses, grpc services, events, commands and state.

Features

  • Implementation of an HTTP/Json based microservice using REST interfaces by defining api requests and responses as protobuf messages.

  • Implementation of a gRPC based microservice using protocol buffer messages. More info: gRPC.

  • ReadSide in-built battery via (Akka Projection).

  • Easy definition of aggregate root, events and command handlers.

  • Pure testable functions for events and commands handlers.

  • Easy definition of api service descriptors.

  • Easy implementation of api service either with message broker api or without.

  • Metadata adds some revision number that can help easily implement optimistic lock.

  • At every event handled a snapshot of the aggregate state with the metadata are made available for the readSide.

  • All events, snapshots and readSide offsets are persisted to Postgres SQL.

  • Encryption trait to enable events and snapshots encryption.

Get Started

  1. Add to your plugins.sbt:
addSbtPlugin("io.superflat" % "lagompb-plugin" % "0.5.0")
  1. Add to your build.sbt:
libraryDependencies ++= Seq(
  "io.superflat" %% "lagompb-core" % "0.5.0",
  "io.superflat" %% "lagompb-core" % "0.5.0 % "protobuf"
)

Sample Project

There is a demo application built on top the library that can be found here Sample

License

This software is licensed under the Apache 2 license, quoted below.

Copyright © 2020 superflat

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

[http://www.apache.org/licenses/LICENSE-2.0] Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.