feat: add kafka admin integration
This commit is contained in:
@@ -324,6 +324,9 @@ type configType struct {
|
||||
Cluster json.RawMessage `json:"cluster_config"`
|
||||
Plugin json.RawMessage `json:"plugins"`
|
||||
Store json.RawMessage `json:"store_config"`
|
||||
Kafka json.RawMessage `json:"kafka"`
|
||||
Internal json.RawMessage `json:"internal_api"`
|
||||
AdminAPI json.RawMessage `json:"admin_internal_api"`
|
||||
Push json.RawMessage `json:"push"`
|
||||
TLS json.RawMessage `json:"tls"`
|
||||
Auth map[string]json.RawMessage `json:"auth_config"`
|
||||
@@ -450,6 +453,17 @@ func main() {
|
||||
}()
|
||||
statsRegisterDbStats()
|
||||
|
||||
if err = initKafkaRuntime(config.Kafka); err != nil {
|
||||
logs.Err.Fatal("Failed to initialize Kafka:", err)
|
||||
}
|
||||
defer stopKafkaRuntime()
|
||||
if err = initInternalAPI(config.Internal); err != nil {
|
||||
logs.Err.Fatal("Failed to initialize internal API:", err)
|
||||
}
|
||||
if err = initAdminInternalAPI(config.AdminAPI); err != nil {
|
||||
logs.Err.Fatal("Failed to initialize Admin internal API client:", err)
|
||||
}
|
||||
|
||||
// API key signing secret
|
||||
globals.apiKeySalt = config.APIKeySalt
|
||||
err = store.InitAuthLogicalNames(config.Auth["logical_names"])
|
||||
@@ -678,6 +692,13 @@ func main() {
|
||||
// The hub (the main message router)
|
||||
globals.hub = newHub()
|
||||
startRedisGroupFanout(context.Background())
|
||||
startKafkaAdminCommandConsumer()
|
||||
startKafkaConfigEventConsumer()
|
||||
startKafkaCacheInvalidateConsumer()
|
||||
startKafkaMessagePersistConsumer()
|
||||
startKafkaFileLifecycleConsumer()
|
||||
startKafkaWorkbenchEventConsumer()
|
||||
startKafkaOutboxPoller()
|
||||
stopExternalBusinessEvents := startIMExternalBusinessEventPoller()
|
||||
defer stopExternalBusinessEvents()
|
||||
|
||||
@@ -832,6 +853,7 @@ func main() {
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/search/conversations", serveIMConversationSearch)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/conversations/p2p", serveIMP2PConversation)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/forward-targets", serveIMForwardTargets)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/messages/forward", serveIMMessageForward)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/system-notifications", serveIMSystemNotifications)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/system-notifications/", serveIMSystemNotificationRead)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/favorites", serveIMFavorites)
|
||||
@@ -852,6 +874,10 @@ func main() {
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/blocks/", serveIMBlockUser)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/friends", serveIMFriends)
|
||||
mux.HandleFunc(config.ApiPath+"v1/im/friends/", serveIMFriendResource)
|
||||
adminQueryPrefix := config.ApiPath + "internal/admin-query/"
|
||||
mux.HandleFunc(adminQueryPrefix, func(wrt http.ResponseWriter, req *http.Request) {
|
||||
serveInternalAdminQuery(wrt, req, adminQueryPrefix)
|
||||
})
|
||||
// Handle long polling clients. Enable compression.
|
||||
mux.Handle(config.ApiPath+"v0/channels/lp", gh.CompressHandler(http.HandlerFunc(serveLongPoll)))
|
||||
if config.Media != nil {
|
||||
|
||||
Reference in New Issue
Block a user