Back to

Package runtimectl

Latest Go to latest

The latest major version is v2.

Published: Feb 8, 2019 | License: Apache-2.0 | Module:


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.



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

func NewResumeCommand

func NewResumeCommand() *lifecycleCommand

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

func NewStartCommand

func NewStartCommand() *lifecycleCommand

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

func NewStopCommand

func NewStopCommand() *lifecycleCommand

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

func NewSuspendCommand

func NewSuspendCommand() *lifecycleCommand

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

func OperateOnFramework

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

func RuntimeCtlEnabled

func RuntimeCtlEnabled(ca *config.ConfigAccessor) bool

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

type RuntimeCtlFacilityBuilder

type RuntimeCtlFacilityBuilder struct {

func (*RuntimeCtlFacilityBuilder) BuildAndRegister

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

func (*RuntimeCtlFacilityBuilder) DependsOnFacilities

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

func (*RuntimeCtlFacilityBuilder) FacilityName

func (fb *RuntimeCtlFacilityBuilder) FacilityName() string

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier