mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Prefix-defined Kafka topics (#1254)
* Prefix-defined Kafka topics * Fix current state server test
This commit is contained in:
parent
4b09f445c9
commit
52eeeb1627
24 changed files with 79 additions and 96 deletions
|
@ -40,7 +40,7 @@ func NewInternalAPI(cfg *config.CurrentStateServer, consumer sarama.Consumer) ap
|
|||
logrus.WithError(err).Panicf("failed to open database")
|
||||
}
|
||||
roomConsumer := consumers.NewOutputRoomEventConsumer(
|
||||
string(cfg.Matrix.Kafka.Topics.OutputRoomEvent), consumer, csDB,
|
||||
cfg.Matrix.Kafka.TopicFor(config.TopicOutputRoomEvent), consumer, csDB,
|
||||
)
|
||||
if err = roomConsumer.Start(); err != nil {
|
||||
logrus.WithError(err).Panicf("failed to start room server consumer")
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
"context"
|
||||
"crypto/ed25519"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"reflect"
|
||||
|
@ -54,7 +55,8 @@ var (
|
|||
testEvents = []gomatrixserverlib.HeaderedEvent{}
|
||||
testStateEvents = make(map[gomatrixserverlib.StateKeyTuple]gomatrixserverlib.HeaderedEvent)
|
||||
|
||||
kafkaTopic = "room_events"
|
||||
kafkaPrefix = "Dendrite"
|
||||
kafkaTopic = fmt.Sprintf("%s%s", kafkaPrefix, "OutputRoomEvent")
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -99,8 +101,8 @@ func MustMakeInternalAPI(t *testing.T) (api.CurrentStateInternalAPI, sarama.Sync
|
|||
stateDBName := "test_state.db"
|
||||
naffkaDBName := "test_naffka.db"
|
||||
cfg.Global.ServerName = "kaer.morhen"
|
||||
cfg.Global.Kafka.Topics.OutputRoomEvent = config.Topic(kafkaTopic)
|
||||
cfg.CurrentStateServer.Database.ConnectionString = config.DataSource("file:" + stateDBName)
|
||||
cfg.Global.Kafka.TopicPrefix = kafkaPrefix
|
||||
db, err := sqlutil.Open(&config.DatabaseOptions{
|
||||
ConnectionString: config.DataSource("file:" + naffkaDBName),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue