github.com/vmware/transport-go@v1.3.4/bus/monitor_event.go (about) 1 // Copyright 2019-2020 VMware, Inc. 2 // SPDX-License-Identifier: BSD-2-Clause 3 4 package bus 5 6 type MonitorEventType int32 7 8 const ( 9 ChannelCreatedEvt MonitorEventType = iota 10 ChannelDestroyedEvt 11 ChannelSubscriberJoinedEvt 12 ChannelSubscriberLeftEvt 13 StoreCreatedEvt 14 StoreDestroyedEvt 15 StoreInitializedEvt 16 BrokerSubscribedEvt 17 BrokerUnsubscribedEvt 18 FabricEndpointSubscribeEvt 19 FabricEndpointUnsubscribeEvt 20 ) 21 22 type MonitorEventHandler func(event *MonitorEvent) 23 24 type MonitorEvent struct { 25 // Type of the event 26 EventType MonitorEventType 27 // The name of the channel or the store related to this event 28 EntityName string 29 // Optional event data 30 Data interface{} 31 } 32 33 // Create a new monitor event 34 func NewMonitorEvent(evtType MonitorEventType, entityName string, data interface{}) *MonitorEvent { 35 return &MonitorEvent{EventType: evtType, Data: data, EntityName: entityName} 36 }