monitor

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: BSD-2-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package monitor defines shared monitor event names without coupling peer packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Type of the event.
	EventType EventType
	// EntityName is the name of the channel, store, or endpoint entity related to this event.
	EntityName string
	// Data carries optional event-specific payload data.
	Data any
}

Event describes a lifecycle event published by Ranch components.

func NewEvent

func NewEvent(evtType EventType, entityName string, data any) *Event

NewEvent creates a monitor event for an entity and optional data payload.

type EventType

type EventType string

EventType names a monitor event.

const (
	// ChannelCreatedEvt is emitted when a bus channel is created.
	ChannelCreatedEvt EventType = "bus.channel.created"
	// ChannelDestroyedEvt is emitted when a bus channel is destroyed.
	ChannelDestroyedEvt EventType = "bus.channel.destroyed"
	// ChannelSubscriberJoinedEvt is emitted when a handler subscribes to a channel.
	ChannelSubscriberJoinedEvt EventType = "bus.channel.subscriber.joined"
	// ChannelSubscriberLeftEvt is emitted when a handler unsubscribes from a channel.
	ChannelSubscriberLeftEvt EventType = "bus.channel.subscriber.left"
	// BrokerSubscribedEvt is emitted when a broker subscription is created.
	BrokerSubscribedEvt EventType = "bus.broker.subscribed"
	// BrokerUnsubscribedEvt is emitted when a broker subscription is removed.
	BrokerUnsubscribedEvt EventType = "bus.broker.unsubscribed"
)
const (
	// StoreCreatedEvt is emitted when a store is created.
	StoreCreatedEvt EventType = "store.created"
	// StoreDestroyedEvt is emitted when a store is destroyed.
	StoreDestroyedEvt EventType = "store.destroyed"
	// StoreInitializedEvt is emitted when a store is initialized.
	StoreInitializedEvt EventType = "store.initialized"
	// FabricEndpointSubscribeEvt is emitted when a STOMP client subscribes through Fabric.
	FabricEndpointSubscribeEvt EventType = "fabric.endpoint.subscribe"
	// FabricEndpointUnsubscribeEvt is emitted when a STOMP client unsubscribes through Fabric.
	FabricEndpointUnsubscribeEvt EventType = "fabric.endpoint.unsubscribe"
)

type Handler

type Handler func(event *Event)

Handler receives monitor events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL