pubsub_service

package
v0.0.0-...-ba64992 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerId

type PeerId string

type PubSubService

type PubSubService interface {
	Start(appCtx context.Context, mongoDatabase *mongo.Database) error
	Stop()
	Publish(tenantId string, topic string, data []byte) error
	Subscribe(tenantId string, topic string, handler SubscribeHandler) SubscribeKey
	Unsubscribe(subscribeKey SubscribeKey)
	Unsubscribes(subscribeKeys []SubscribeKey)
}

func New

func New(peerService peer_service.PeerService) PubSubService

type SubscribeContext

type SubscribeContext struct {
	// contains filtered or unexported fields
}

type SubscribeHandler

type SubscribeHandler func(tenantId string, topic string, data []byte, subscribeKey SubscribeKey) error

type SubscribeHandlerMap

type SubscribeHandlerMap map[SubscribeKey]SubscribeHandler

type SubscribeKey

type SubscribeKey string

func NewSubscribeKey

func NewSubscribeKey() SubscribeKey

type SubscriberDocument

type SubscriberDocument struct {
	Id          primitive.ObjectID `bson:"_id,omitempty"`
	TenantId    string             `bson:"tenantId"`
	Topic       string             `bson:"topic"`
	PeerId      string             `bson:"peerId"`
	HeartbeatAt time.Time          `bson:"heartbeatAt"`
}

func (*SubscriberDocument) GetId

func (d *SubscriberDocument) GetId() string

func (*SubscriberDocument) ToBson

func (d *SubscriberDocument) ToBson() (bson.M, error)

func (*SubscriberDocument) TopicKey

func (d *SubscriberDocument) TopicKey() TopicKey

type TopicKey

type TopicKey string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL