Skip to content

Application Core

Angel Sanadinov edited this page Apr 7, 2017 · 4 revisions

Components

A core3 application is made up of a number of components based on Akka Actors and they implement the core3.core.Component and core3.core.ComponentCompanion traits.

All of them can be managed by a core3.core.ComponentManager, normally configured in an app's Module definition. For example:

import akka.actor.ActorSystem
import akka.util.Timeout
import core3.config.StaticConfig
import com.google.inject.{AbstractModule, Provides, Singleton}
import core3.core.{ComponentManager, ComponentManagerActor}
import core3.database.dals.DatabaseAbstractionLayer
import core3.workflows.WorkflowEngine
import net.codingwell.scalaguice.ScalaModule
import play.api.{Environment, Mode}

import scala.concurrent.ExecutionContext
import scala.concurrent.duration._

class Module extends AbstractModule with ScalaModule {

  ...

  @Provides
  @Singleton
  def provideComponentManager(system: ActorSystem, engine: WorkflowEngine, db: DatabaseAbstractionLayer)(implicit ec: ExecutionContext): ComponentManager = {
    val managerConfig = StaticConfig.get.getConfig("manager")
    implicit val timeout = Timeout(managerConfig.getInt("requestTimeout").seconds)

    new ComponentManager(
      system.actorOf(
        ComponentManagerActor.props(
          Map(
            "engine" -> engine.getRef,
            "db" -> db.getRef
          )
        )
      )
    )
  }

  ...

}

Local Console

Allows the management of a core3-based application, when started in the foreground with the appropriate CLI flag (application-defined). For example (starts the core3-example-engine, with the console enabled):

sbt run -Dhttps.port=9900 -Dhttp.port=disabled -Dc3ee.console=enabled

Currently, the local console behaves normally only when the application is started directly with a jar and not via sbt / Play.

Default commands

  • help - shows the help menu
  • quit - terminates the application
  • version - shows version information
  • system - allows management of the application's core (configuration, state, etc)

Component commands

Each component supplies it's own set of commands; see the running app's help menu for more information.

Clone this wiki locally