Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for consumer multiple filters and streams/consumers metadata #138

Merged
merged 6 commits into from
Nov 22, 2023

Conversation

wallyqs
Copy link
Member

@wallyqs wallyqs commented Nov 22, 2023

Examples:

# Creating a stream with multiple subjects
js.add_stream(name: "MULTI_FILTER", subjects: ["foo.one.*", "foo.two.*", "foo.three.*"])

# PullSubscriber that takes an array and creates a consumer with multiple filters .
js.pull_subscribe(["foo.one.1", "foo.two.2"], "example")

# PushSubscriber that takes an array and creates a consumer with multiple filters .
js.subscribe(["foo.one.1", "foo.three.3"])

# via JetStream#add_consumer API
consumer = js.add_consumer("MULTI_FILTER", {
       name: "my-consumer",
       filter_subjects: ["foo.one.*", "foo.two.*"]
})

# Pass nil to both subject and durable consumer name to bind to already created consumer
js.pull_subscribe(nil, nil, name: "my-consumer", stream: "MULTI_FILTER")

# Stream with metadata
stream = js.add_stream({
    :name     => "WITH_METADATA",
    :metadata => {
      'foo': 'bar',
      'hello': 'world'
    }
})

Signed-off-by: Waldemar Quevedo <wally@nats.io>
Signed-off-by: Waldemar Quevedo <wally@nats.io>
Signed-off-by: Waldemar Quevedo <wally@nats.io>
Signed-off-by: Waldemar Quevedo <wally@nats.io>
Signed-off-by: Waldemar Quevedo <wally@nats.io>
Signed-off-by: Waldemar Quevedo <wally@nats.io>
@wallyqs wallyqs merged commit 1fb937b into main Nov 22, 2023
2 checks passed
@wallyqs wallyqs deleted the add-consumer-filters branch November 22, 2023 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant