github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/pkg/plugin/events.go (about) 1 package plugin 2 3 import ( 4 "github.com/hellofresh/janus/cassandra/wrapper" 5 "github.com/hellofresh/stats-go/client" 6 "go.mongodb.org/mongo-driver/mongo" 7 8 "github.com/hellofresh/janus/pkg/api" 9 "github.com/hellofresh/janus/pkg/config" 10 "github.com/hellofresh/janus/pkg/proxy" 11 "github.com/hellofresh/janus/pkg/router" 12 ) 13 14 // Define the event names for the startup and shutdown events 15 const ( 16 StartupEvent = "startup" 17 AdminAPIStartupEvent = "admin_startup" 18 19 ReloadEvent = "reload" 20 ShutdownEvent = "shutdown" 21 SetupEvent = "setup" 22 ) 23 24 // OnStartup represents a event that happens when Janus starts up on the main process 25 type OnStartup struct { 26 StatsClient client.Client 27 MongoDB *mongo.Database 28 Cassandra wrapper.Holder 29 Register *proxy.Register 30 Config *config.Specification 31 Configuration []*api.Definition 32 } 33 34 // OnReload represents a event that happens when Janus hot reloads it's configurations 35 type OnReload struct { 36 Configurations []*api.Definition 37 } 38 39 // OnAdminAPIStartup represents a event that happens when Janus starts up the admin API 40 type OnAdminAPIStartup struct { 41 Router router.Router 42 }