fix rule of stream and subject name

This commit is contained in:
Nam Huynh 2021-10-08 14:45:07 +07:00
parent 35714c8292
commit 95dead981a
1 changed files with 5 additions and 3 deletions

View File

@ -8,10 +8,12 @@ import (
)
// QueueSubscribe ...
func QueueSubscribe(subject, queueName string, cb nats.MsgHandler) error {
_, err := natsJS.QueueSubscribe(subject, queueName, cb)
func QueueSubscribe(stream, subject, queueName string, cb nats.MsgHandler) error {
channel := combineStreamAndSubjectName(stream, subject)
_, err := natsJS.QueueSubscribe(channel, queueName, cb)
if err != nil {
msg := fmt.Sprintf("queue subscribe with subject %s error: %s", subject, err.Error())
msg := fmt.Sprintf("queue subscribe with subject %s error: %s", channel, err.Error())
return errors.New(msg)
}
return nil