Opampcustommessages Extension
Overview
Overview
This modules contains interfaces and shared code for sending and receiving custom messages via OpAMP.Usage
An extension may implement theopampcustommessages.CustomCapabilityRegistry interface, which allows other components to register capabilities to send and receive messages to/from an OpAMP server. For an example of a component implementing this interface, see the OpAMP extension.
Registering a custom capability
Other components may use a configured OpAMP extension to send and receive custom messages to and from an OpAMP server. Components may use the providedcomponents.Host from the Start method in order to get a handle to the registry:
Using a CustomCapabilityHandler to send/receive messages
After obtaining a handler for the custom capability, you can send and receive messages for the custom capability by using the SendMessage and Message methods, respectively:Sending a message
To send a message, you can use the SendMessage method. Since only one custom message can be scheduled to send at a time, the error returned should be checked if itβs ErrCustomMessagePending, and wait on the returned channel to attempt sending the message again.Receiving a message
Messages can be received through the channel returned by theMessage method on the handler:
Unregistering a capability
After a component is done processing messages for a given capability, or shuts down, it should unregister its handler. You can do this by calling theUnregister method:
Last generated: 2026-04-13