Packages

  • package root

    glngn server is a low-code business process as a service rapid development system.

    glngn server is a low-code business process as a service rapid development system. Conceptually similar to a programmable Microsoft Access or Apple FileMaker for scalable event sourced business services. In addition to a library, a standalone application is provided that is useful with minimal ceremony. This can be customized with a simple API. As well as deployed to a kubernetes cluster should those advantages be required.

    A deployment is cluster of glngn.server.node.AppNodes serving a dynamic composition of glngn.server.ServiceFragments. Deployments are designed to be fully usable as a standalone local application or a kubernetes service.

    Contact support@dogheadbone.com for support and licensing.

    Definition Classes
    root
  • package glngn
    Definition Classes
    root
  • package server

    Definition Classes
    glngn
  • package core
    Definition Classes
    server
  • package bindings
    Definition Classes
    core
  • trait ServiceBindings extends ServiceActor

    Declarative mapping from a service domain's protocol to implementations.

    Declarative mapping from a service domain's protocol to implementations. Included in ServiceFragment.

    In glngn server, the mapping of service domain protocol to implementations is refered to as the bindings: the binding of a domain term to an implementation. Logically similar to data binding in UI controller libraries. The bindings are determined by evaluating Instance.bindings for each service actor instance.

    See Bindings for the EDSL for declaring bindings.

    The ServiceBindings trait enforces this by requiring the ServiceActor object to define an Instance class implementing BindingsInstance. The ServiceFragment's Instance already satisfies this requirement.

    object BalanceSheet extends ServiceActor with ServiceBindings {
      sealed trait Proto extends Message
      case class PrintAndMailBalance(accountId: Int) extends Proto with Command[Unit]
      case class PostBalanceToMessageBus(accountId: Int) extends Proto with Command[Balance]
    
      class Instance(val env: InstanceEnv) extends BindingsInstance {
        import Bindings._
    
        val behavior: Behavior[Envelope] = Behaviors.receiveMessagePartial {
          case Request(scope, PostBalanceToMessageBus(accountId)) => {
            val balance = getBalanceNonIO(accountId)
            postBalanceToMessageBus(balance)
            scope.provide(balance)
            Behaviors.same
          }
        }
    
        // chain sequences individual Bindings[_].
        def bindings: Bindings[_] = chain(
          // a Bindings[_] constructor from object Bindings
          // this performs the given IO on protocol match.
          responderIO {
            case PrintAndMailBalance(accountId) => requestBalanceSheet(accountId) >>= printInMailroom
          },
          // a Bindings[_] constructor from object Bindings
          // this delegates to an akka typed Behavior[Envelope]
          delegate(behavior)
        )
      }
    }
    Definition Classes
    bindings
  • Bindings
  • BindingsInstance
  • Command
  • DelegateOps
  • Envelope
  • Event
  • Instance
  • InstanceEnv
  • Proto
  • Query
  • Request
  • StopEnvelope

object Bindings

Methods to bind this service's protocol to implementations.

If a binding is not provided for a protocol message the message is considered unhandled. Any endpoint for the protocol message will reply with HTTP 501 Not Implemented.

// a hypothetical service for account balances
final object AServiceFragment extends ServiceFragment {

  override def instantiate(env: InstanceEnv) = new Instance(env) {
    // the service event consumer is implemented using...
    val bindings = bindingsChain(
      // operations on a named entity
      entity(AnEntity) {
        case ServiceOperationOnEntity(entityId) => AnEntity.AnOperation -> accountId
      },
      // a daemon sending Proto messages back to this service
      async(OrdersOverSMSBehavior) // where OrdersOverSMSBehavior being a [[ServiceActorDaemon]]
    )
}
}
Linear Supertypes
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Bindings
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final type FunctionHandler = PartialFunction[ServiceBindings.Envelope, _]

    see handler

  2. final type FunctionResponder[R] = PartialFunction[ServiceBindings.AnyRequest, R]

    see responder

  3. final type HandlerIO = PartialFunction[ServiceBindings.Envelope, AppTask[Unit]]

    see handlerIO

  4. final type ResponderIO[R] = PartialFunction[ServiceBindings.AnyRequest, AppTask[R]]

    see responderIO

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def async(serviceDaemon: ServiceDaemon[ServiceBindings.Envelope]): Bindings[_]

    Starts the given ServiceDaemon that will be provided a reference to this service actor.

    Starts the given ServiceDaemon that will be provided a reference to this service actor. The daemon operates using it's own protocol . The behavior is provided a reference to this service actor.

    Alias of daemon.

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. def daemon(serviceDaemon: ServiceDaemon[ServiceBindings.Envelope]): Bindings[_]

    Starts the given ServiceDaemon that will be provided a reference to this service actor.

    Starts the given ServiceDaemon that will be provided a reference to this service actor. The daemon operates using it's own protocol . The behavior is provided a reference to this service actor.

  8. def delegate(behavior: prelude.external.Behavior[ServiceBindings.Envelope]): Bindings[_]

    All protocol messages (in an envelope) that have not thus matched a binding will be provided to the behavior.

    All protocol messages (in an envelope) that have not thus matched a binding will be provided to the behavior. Logically similar to delegating to an actor with a behavior on envelopes.

  9. val empty: Bindings[Unit]

    Empty bindings; All protocol events are unhandled.

  10. def entity[E <: ServiceEntity](entityType: E, logicalDomain: String)(pf: PartialFunction[ServiceBindings.Proto, Bindings.entity.E.RequestWithId]): Bindings[_]

    Delegates the match protocol message to persistent entities defined by a given ServiceEntity.

    Delegates the match protocol message to persistent entities defined by a given ServiceEntity.

    The delegation is defined by a partial function from the domain protocol to an entity identifier and entity protocol.

  11. def entity[E <: ServiceEntity](entityType: E)(pf: PartialFunction[ServiceBindings.Proto, Bindings.entity.E.RequestWithId]): Bindings[_]

    Delegates the match protocol message to persistent entities defined by a given ServiceEntity.

    Delegates the match protocol message to persistent entities defined by a given ServiceEntity.

    The delegation is defined by a partial function from the domain protocol to an entity identifier and entity protocol.

  12. def entity[E <: ServiceEntity](entityType: E, logicalDomain: Option[String])(pf: PartialFunction[ServiceBindings.Proto, Bindings.entity.E.RequestWithId]): Bindings[_]

    Delegates the match protocol message to persistent entities defined by a given ServiceEntity.

    Delegates the match protocol message to persistent entities defined by a given ServiceEntity.

    The delegation is defined by a partial function from the domain protocol to an entity identifier and entity protocol.

  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def handler(f: FunctionHandler): Bindings[_]

    Invoke an function on matched ServiceActor.Envelope.

    Invoke an function on matched ServiceActor.Envelope.

    val addToDatabaseImpure: Response = ???
    
    val exampleBinding = handler {
      case Request(scope, ACommand(value)) => {
        val response = addToDatabaseImpure(value)
        scope.provide(databaseResponse)
      }
    }
  18. def handlerIO(p: HandlerIO): Bindings[_]

    Execute the given AppTask action for matched protocol messages.

    Execute the given AppTask action for matched protocol messages.

    The action is provided the request scope and is expected to provide a response within the timeout required by the endpoint.

    val addToDatabaseIO: IO[Response] = ???
    
    val exampleBinding = handlerIO {
      case Request(scope, ACommand(value)) =>
        addToDatabaseIO(value) flatMap { databaseResponse =>
          scope.provide(databaseResponse)
        }
    }
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. def responder[R](f: FunctionResponder[R])(implicit arg0: Manifest[R]): Bindings[_]

    Invoke an function on matched ServiceActor.Envelope.

    Invoke an function on matched ServiceActor.Envelope.

    val addToDatabaseImpure: Response = ???
    
    val exampleBinding = responder {
      case ACommand(value) => addToDatabaseImpure(value)
    }
  25. def responderIO[R](p: ResponderIO[R])(implicit arg0: Manifest[R]): Bindings[_]

    Execute the given AppTask action for matched protocol messages.

    Execute the given AppTask action for matched protocol messages. Respond with result of AppTask.

    val addToDatabaseIO: IO[Response] = ???
    
    val exampleBinding = responderIO {
      case ACommand(value) => addToDatabaseIO(value)
    }
  26. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  27. def toString(): String
    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Service Logic

Implementation Detail

Ungrouped