Back to godoc.org

Package runtimectl

v1.3.0
Latest Go to latest

The latest major version is v2.

Published: Feb 8, 2019 | License: Apache-2.0 | Module: github.com/graniticio/granitic

Overview

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

This facility is described in detail at http://granitic.io/1.0/ref/runtime-ctl. 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 http://granitic.io/1.0/ref/runtime-ctl#builtin 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": {
	"Server":{
	  "Port": 9099,
	  "Address": "127.0.0.1"
	}
  }
}

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": {
  "Manager":{
    "Disabled": ["shutdown"]
  }
}

}

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

Index

Constants

const (
	All = iota
	FrameworkOwned
	ApplicationOwned
)
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