Add pull subscribe #1
|
@ -55,7 +55,7 @@ func (js JetStream) PullSubscribe(stream, subject, durable, consumer string) (*n
|
||||||
info, err := js.instance.AddConsumer(stream, &nats.ConsumerConfig{
|
info, err := js.instance.AddConsumer(stream, &nats.ConsumerConfig{
|
||||||
Durable: durable,
|
Durable: durable,
|
||||||
AckPolicy: nats.AckExplicitPolicy,
|
AckPolicy: nats.AckExplicitPolicy,
|
||||||
FilterSubject: channel,
|
FilterSubject: subject,
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Println("CONSUMER INFO", info)
|
fmt.Println("CONSUMER INFO", info)
|
||||||
|
|
11
natsio.go
11
natsio.go
|
@ -21,6 +21,9 @@ type JetStream struct {
|
||||||
var (
|
var (
|
||||||
natsServer Server
|
natsServer Server
|
||||||
natsJetStream JetStream
|
natsJetStream JetStream
|
||||||
|
|
||||||
|
// FIXME: delete this
|
||||||
|
jsPublic nats.JetStreamContext
|
||||||
)
|
)
|
||||||
|
|
||||||
// Connect ...
|
// Connect ...
|
||||||
|
@ -62,6 +65,9 @@ func Connect(cfg Config) error {
|
||||||
}
|
}
|
||||||
natsJetStream.instance = js
|
natsJetStream.instance = js
|
||||||
|
|
||||||
|
// FIXME: delete this
|
||||||
|
jsPublic = js
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,3 +80,8 @@ func GetServer() Server {
|
||||||
func GetJetStream() JetStream {
|
func GetJetStream() JetStream {
|
||||||
return natsJetStream
|
return natsJetStream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetJSPublic ...
|
||||||
|
func GetJSPublic() nats.JetStreamContext {
|
||||||
|
return jsPublic
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue