Skip to content

Commit

Permalink
use ephemeral
Browse files Browse the repository at this point in the history
  • Loading branch information
jibon57 committed Sep 23, 2024
1 parent 5ebd730 commit ea8a116
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/services/nats/js_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func (s *NatsService) CreateChatConsumer(roomId, userId string) (jwt.StringList, error) {
_, err := s.js.CreateOrUpdateConsumer(s.ctx, roomId, jetstream.ConsumerConfig{
Durable: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.Chat, userId),
Name: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.Chat, userId),
FilterSubjects: []string{
fmt.Sprintf("%s:%s.>", roomId, s.app.NatsInfo.Subjects.Chat),
},
Expand All @@ -29,7 +29,7 @@ func (s *NatsService) CreateChatConsumer(roomId, userId string) (jwt.StringList,

func (s *NatsService) CreateSystemPublicConsumer(roomId, userId string) (jwt.StringList, error) {
_, err := s.js.CreateOrUpdateConsumer(s.ctx, roomId, jetstream.ConsumerConfig{
Durable: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.SystemPublic, userId),
Name: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.SystemPublic, userId),
DeliverPolicy: jetstream.DeliverNewPolicy,
FilterSubjects: []string{
fmt.Sprintf("%s:%s.>", roomId, s.app.NatsInfo.Subjects.SystemPublic),
Expand All @@ -50,7 +50,7 @@ func (s *NatsService) CreateSystemPublicConsumer(roomId, userId string) (jwt.Str

func (s *NatsService) CreateSystemPrivateConsumer(roomId, userId string) (jwt.StringList, error) {
_, err := s.js.CreateOrUpdateConsumer(s.ctx, roomId, jetstream.ConsumerConfig{
Durable: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.SystemPrivate, userId),
Name: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.SystemPrivate, userId),
DeliverPolicy: jetstream.DeliverNewPolicy,
FilterSubjects: []string{
fmt.Sprintf("%s:%s.%s.>", roomId, s.app.NatsInfo.Subjects.SystemPrivate, userId),
Expand All @@ -71,7 +71,7 @@ func (s *NatsService) CreateSystemPrivateConsumer(roomId, userId string) (jwt.St

func (s *NatsService) CreateWhiteboardConsumer(roomId, userId string) (jwt.StringList, error) {
_, err := s.js.CreateOrUpdateConsumer(s.ctx, roomId, jetstream.ConsumerConfig{
Durable: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.Whiteboard, userId),
Name: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.Whiteboard, userId),
DeliverPolicy: jetstream.DeliverNewPolicy,
FilterSubjects: []string{
fmt.Sprintf("%s:%s.>", roomId, s.app.NatsInfo.Subjects.Whiteboard),
Expand All @@ -93,7 +93,7 @@ func (s *NatsService) CreateWhiteboardConsumer(roomId, userId string) (jwt.Strin

func (s *NatsService) CreateDataChannelConsumer(roomId, userId string) (jwt.StringList, error) {
_, err := s.js.CreateOrUpdateConsumer(s.ctx, roomId, jetstream.ConsumerConfig{
Durable: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.DataChannel, userId),
Name: fmt.Sprintf("%s:%s", s.app.NatsInfo.Subjects.DataChannel, userId),
DeliverPolicy: jetstream.DeliverNewPolicy,
FilterSubjects: []string{
fmt.Sprintf("%s:%s.>", roomId, s.app.NatsInfo.Subjects.DataChannel),
Expand Down

0 comments on commit ea8a116

Please sign in to comment.