Add pull subscribe #1

Merged
namhq1989 merged 12 commits from add-pull-subscribe into master 2022-03-18 04:28:50 +00:00
1 changed files with 6 additions and 1 deletions
Showing only changes of commit f6d6b5afee - Show all commits

View File

@ -44,7 +44,12 @@ func (js JetStream) Subscribe(stream, subject string, cb nats.MsgHandler) (*nats
// // process each messages
// }
//
func (js JetStream) PullSubscribe(subject, durable string) (*nats.Subscription, error) {
func (js JetStream) PullSubscribe(stream, subject, durable, consumer string) (*nats.Subscription, error) {
// Check if consumer existed
con, err := js.instance.ConsumerInfo(stream, consumer)
fmt.Println("con", con)
fmt.Println("err", err)
sub, err := js.instance.PullSubscribe(subject, durable)
if err != nil {
msg := fmt.Sprintf("[NATS JETSTREAM] - pull subscribe subject #%s - durable #%s error: %s", subject, durable, err.Error())