granitic: Index | Files

package runtimectl

import ""

Package runtimectl provides the RuntimeCtl facility which allows external runtime control of Granitic applications.

This facility is described in detail at Refer to the ctl package documentation for information on how to implement your own commands.

Enabling runtime control

Enabling the RuntimeCtl facility creates an HTTP server that allows instructions to be issued to any component in the IoC container which implements the ctl.Command interface from the grnc-ctl command line tool. See for documentation on Granitic's built-in commands.

The HTTP server that listens for commands is separate to the HTTP server created by the XmlWs and JsonWs facilities and runs on a different port. The listen port defaults to 9099 but can be changed with the following configuration:

  "RuntimeCtl": {
	  "Port": 9099,
	  "Address": ""

Note that by default the server only listens on the IPV4 localhost. To listen on all interfaces, change address to ""

Disabling individual commands

You can disable individual commands (either builtin commands or your own application commands) with configuration. For example:


"RuntimeCtl": {
    "Disabled": ["shutdown"]


Disables the shutdown command, preventing your application being stopped remotely.


Package Files

builder.go builtin.go components.go help.go lifecycle.go shutdown.go start.go stop.go suspend.go


const (
    All = iota
const (
    RuntimeCtlServer = instance.FrameworkPrefix + "CtlServer"

func NewResumeCommand Uses

func NewResumeCommand() *lifecycleCommand

Create a variant of the lifecycleCommand configured as the resume command.

func NewStartCommand Uses

func NewStartCommand() *lifecycleCommand

Create a variant of the lifecycleCommand configured as the start command.

func NewStopCommand Uses

func NewStopCommand() *lifecycleCommand

Create a variant of the lifecycleCommand configured as the stop command.

func NewSuspendCommand Uses

func NewSuspendCommand() *lifecycleCommand

Create a variant of the lifecycleCommand configured as the suspend command.

func OperateOnFramework Uses

func OperateOnFramework(args map[string]string) (bool, error)

func RuntimeCtlEnabled Uses

func RuntimeCtlEnabled(ca *config.ConfigAccessor) bool

RuntimeCtlEnabled checks to see if the RuntimeCtl facility is enabled in configuration.

type RuntimeCtlFacilityBuilder Uses

type RuntimeCtlFacilityBuilder struct {

func (*RuntimeCtlFacilityBuilder) BuildAndRegister Uses

func (fb *RuntimeCtlFacilityBuilder) BuildAndRegister(lm *logging.ComponentLoggerManager, ca *config.ConfigAccessor, cc *ioc.ComponentContainer) error

func (*RuntimeCtlFacilityBuilder) DependsOnFacilities Uses

func (fb *RuntimeCtlFacilityBuilder) DependsOnFacilities() []string

func (*RuntimeCtlFacilityBuilder) FacilityName Uses

func (fb *RuntimeCtlFacilityBuilder) FacilityName() string

Package runtimectl imports 18 packages (graph) and is imported by 2 packages. Updated 2018-03-13. Refresh now. Tools for package owners.