e071084ebe
govulncheck / govulncheck (push) Waiting to run
Harness (E2E) / Harnesses (mock LLM) (push) Waiting to run
Harness (E2E) / Provider harnesses (live LLM conformance) (push) Waiting to run
Lint / golangci-lint (push) Waiting to run
Run Tests / Unit Tests (push) Waiting to run
Run Tests / Etcd Integration Tests (push) Waiting to run
NATS JetStream
This plugin uses NATS with JetStream to send and receive events.
Create a stream
ev, err := natsjs.NewStream(
natsjs.Address("nats://10.0.1.46:4222"),
natsjs.MaxAge(24*160*time.Minute),
)
Consume a stream
ee, err := events.Consume("test",
events.WithAutoAck(false, time.Second*30),
events.WithGroup("testgroup"),
)
if err != nil {
panic(err)
}
go func() {
for {
msg := <-ee
// Process the message
logger.Info("Received message:", string(msg.Payload))
err := msg.Ack()
if err != nil {
logger.Error("Error acknowledging message:", err)
} else {
logger.Info("Message acknowledged")
}
}
}()
Publish an Event to the stream
err = ev.Publish("test", []byte("hello world"))
if err != nil {
panic(err)
}