Added
- Added support for multiple filter consumers when using nats-server +v2.10
This is only supported when using the `pull_subscribe_bind` API:
python
await jsm.add_stream(name="multi", subjects=["a", "b", "c.>"])
cinfo = await jsm.add_consumer(
"multi",
name="myconsumer",
filter_subjects=["a", "b"],
)
psub = await js.pull_subscribe_bind("multi", "myconsumer")
msgs = await psub.fetch(2)
for msg in msgs:
await msg.ack()
- Added `subjects_filter` option to `js.stream_info()` API
python
stream = await js.add_stream(name="foo", subjects=["foo.>"])
for i in range(0, 5):
await js.publish("foo.%d" % i, b'A')
si = await js.stream_info("foo", subjects_filter=">")
print(si.state.subjects)
=> {'foo.0': 1, 'foo.1': 1, 'foo.2': 1, 'foo.3': 1, 'foo.4': 1}
Changed
- Changed kv.watch default `inactive_threshold` cleanup timeout to be 5 minutes.
It can now be customized as well by passing `inactive_threshold` as argument in seconds:
w = await kv.watchall(inactive_threshold=30.0)
- Changed `pull_subscribe_bind` first argument to be called `consumer` instead of `durable`
since it also supports ephemeral consumers. This should be backwards compatible.
python
psub = await js.pull_subscribe_bind(consumer="myconsumer", stream="test")