Packages

o

glngn.server.services

CounterService

object CounterService extends ServiceFragment

Service providing named counters of integer value.

Exported endpoints are:

  • GET $name - value of counter with name.
  • POST $name/inc - increment value of counter with name.
  • POST $name/dec - decrement value of counter with name.
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. CounterService
  2. ServiceFragment
  3. ServiceEndpoints
  4. ActorService
  5. ServiceBindings
  6. ServiceActor
  7. DirectLogging
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class Instance extends EndpointsInstance with ServiceInstance

    Definition Classes
    ServiceFragment
  2. case class InstanceEnv(spawner: prelude.ActorSpawner, injector: prelude.Injector, groupId: GroupId, serviceId: ServiceId) extends BindingsInstanceEnv with Product with Serializable

    Definition Classes
    ServiceFragment
  3. trait ServiceInstance extends BindingsInstance

    Definition Classes
    ActorService
  4. abstract class Command[Response] extends Request[Response] with proto.ProtoDecl.Command with proto.ProtoDecl.Request

    All commands are Requests with Proto: extends Command[R] with Proto.

    All commands are Requests with Proto: extends Command[R] with Proto.

    sealed trait Proto extends Message
    case class ExampleCommand(msg: String) extends Command[ExampleResponse] with Proto
    Definition Classes
    ServiceActor
  5. sealed trait Envelope extends Product with Message with Serializable

    A Proto event with additional attributes and claims.

    A Proto event with additional attributes and claims. To pattern match on an Envelope use the Event.unapply or Request.unapply extractors.

    val behavior: Behavior[Envelope] = Behaviors.receiveMessagePartial {
      case Event(SomeEvent(eventData)) => ???
      case Request(scope, SomeCommand(eventData)) => ???
    }

    An Envelope can be implicitly constructed from any Proto.

    val delegate: ActorRef[Envelope] = ???
    val anEvent: Proto = SomeEvent(eventData)
    delegate ! anEvent
    Definition Classes
    ServiceActor
  6. abstract class Query[Response] extends Request[Response] with proto.ProtoDecl.Query with proto.ProtoDecl.Request

    All queries are Requests with Proto: extends Query[R] with Proto.

    All queries are Requests with Proto: extends Query[R] with Proto.

    sealed trait Proto extends Message
    case class ExampleQuery(msg: String) extends Query[ExampleResponse] with Proto
    Definition Classes
    ServiceActor
  7. sealed abstract class Request[R] extends AnyRef

    A protocol event can be declared as a Request using Command or Query.

    A protocol event can be declared as a Request using Command or Query. The type parameter is the response that resolves the request.

    sealed trait Proto extends Message
    case class ExampleCommand(msg: String) extends Command[ExampleResponse] with Proto
    case class ExampleQuery(msg: String) extends Query[ExampleResponse] with Proto
    Definition Classes
    ServiceActor
  8. trait BindingsInstance extends AnyRef

    Definition Classes
    ServiceBindings
  9. implicit class DelegateOps extends AnyRef

    Definition Classes
    ServiceBindings
  10. abstract class EndpointsInstance extends BindingsInstance

    Definition Classes
    ServiceEndpoints
  11. sealed trait EndpointsOp[A] extends AnyRef

    Definition Classes
    ServiceEndpoints
  12. type Amount = Int

  13. final type AnyRequest = Proto with Request[_]

    AnyRequest is a Command or Query with no particular response type.

    AnyRequest is a Command or Query with no particular response type.

    Definition Classes
    ServiceActor
  14. final type Bindings[A] = FreeApplicative[BindingsOp, A]

    Type of bindings declaration.

    Type of bindings declaration.

    Definition Classes
    ServiceBindings
  15. final case class DecCounterWithName(name: Name, amount: Amount) extends Command[State] with Proto with Product with Serializable

  16. final type Delegate = ActorRef[Envelope]

    The delegate is an actor accepting events in Envelope messages.

    The delegate is an actor accepting events in Envelope messages.

    Definition Classes
    ServiceBindings
  17. final type Endpoints[A] = FreeApplicative[EndpointsOp, A]

    Definition Classes
    ServiceEndpoints
  18. final case class GetCounterWithName(name: Name) extends Query[State] with Proto with Product with Serializable

  19. final case class IncCounterWithName(name: Name, amount: Amount) extends Command[State] with Proto with Product with Serializable

  20. type Name = EntityId

  21. sealed trait Proto extends prelude.Message

Value Members

  1. object Instance

    Definition Classes
    ServiceFragment
  2. object Envelope extends Serializable

    Definition Classes
    ServiceActor
  3. object Event

    Any statement in the protocol can be considered an Event not associated with any additional scope.

    Any statement in the protocol can be considered an Event not associated with any additional scope.

    - see also ServiceActor.RequestScope and Request.unapply

    Definition Classes
    ServiceActor
  4. object EventSourcedEntity

    Re-export of akka.cluster.sharding.typed.scaladsl.EventSourcedEntity with types constrained to this service actor's protocol.

    Re-export of akka.cluster.sharding.typed.scaladsl.EventSourcedEntity with types constrained to this service actor's protocol.

    Definition Classes
    ServiceActor
  5. object Request

    Definition Classes
    ServiceActor
  6. object Bindings

    Methods to bind this service's protocol to implementations.

    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]]
        )
    }
    }
    Definition Classes
    ServiceBindings
  7. object Endpoints

    Definition Classes
    ServiceEndpoints
  8. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def ##(): Int
    Definition Classes
    AnyRef → Any
  10. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  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 hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def instantiate(env: InstanceEnv): Instance

    Definition Classes
    CounterServiceServiceFragment
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. lazy val logger: prelude.Logger
    Attributes
    protected
    Definition Classes
    DirectLogging
  21. val logicalId: LogicalServiceId

    A logical identifier unique in the deployment.

    A logical identifier unique in the deployment. Defaults to class name.

    Definition Classes
    ServiceFragment
  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from ServiceFragment

Inherited from ServiceEndpoints

Inherited from ActorService

Inherited from ServiceBindings

Inherited from ServiceActor

Inherited from prelude.DirectLogging

Inherited from AnyRef

Inherited from Any

Service Protocol

Service Logic

Implementation Detail

Ungrouped