diff --git a/.gitignore b/.gitignore index 144c74f24d..5b15e18a28 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ site TODO.md release_notes.md .idea -.vscode \ No newline at end of file +.vscode +.op \ No newline at end of file diff --git a/internal/impl/nats/input_jetstream.go b/internal/impl/nats/input_jetstream.go index 98ff965392..bf6a4310f8 100644 --- a/internal/impl/nats/input_jetstream.go +++ b/internal/impl/nats/input_jetstream.go @@ -68,8 +68,10 @@ You can access these metadata fields using Description("Indicates that the subscription should use an existing consumer."). Optional()). Field(service.NewStringAnnotatedEnumField("deliver", map[string]string{ - "all": "Deliver all available messages.", - "last": "Deliver starting with the last published messages.", + "all": "Deliver all available messages.", + "last": "Deliver starting with the last published messages.", + "last_per_subject": "Deliver starting with the last published message per subject.", + "new": "Deliver starting from now, not taking into account any previous messages.", }). Description("Determines which messages to deliver when consuming without a durable subscriber."). Default("all")). @@ -153,6 +155,10 @@ func newJetStreamReaderFromConfig(conf *service.ParsedConfig, mgr *service.Resou j.deliverOpt = nats.DeliverAll() case "last": j.deliverOpt = nats.DeliverLast() + case "last_per_subject": + j.deliverOpt = nats.DeliverLastPerSubject() + case "new": + j.deliverOpt = nats.DeliverNew() default: return nil, fmt.Errorf("deliver option %v was not recognised", deliver) } diff --git a/website/docs/components/inputs/nats_jetstream.md b/website/docs/components/inputs/nats_jetstream.md index ac2cc701a5..6d30fdf19f 100644 --- a/website/docs/components/inputs/nats_jetstream.md +++ b/website/docs/components/inputs/nats_jetstream.md @@ -213,6 +213,8 @@ Default: `"all"` |---|---| | `all` | Deliver all available messages. | | `last` | Deliver starting with the last published messages. | +| `last_per_subject` | Deliver starting with the last published message per subject. | +| `new` | Deliver starting from now, not taking into account any previous messages. | ### `ack_wait`