aboutsummaryrefslogtreecommitdiff
path: root/syncapi/producers/appservices.go
blob: af304542ca3172af08fcae936cfad6f92096f6f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2024 New Vector Ltd.
// Copyright 2023 The Matrix.org Foundation C.I.C.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.

package producers

import (
	"github.com/nats-io/nats.go"
)

// AppserviceEventProducer produces events for the appservice API to consume
type AppserviceEventProducer struct {
	Topic     string
	JetStream nats.JetStreamContext
}

func (a *AppserviceEventProducer) ProduceRoomEvents(
	msg *nats.Msg,
) error {
	msg.Subject = a.Topic
	_, err := a.JetStream.PublishMsg(msg)
	return err
}