watermill
watermill copied to clipboard
[watermill-nats] smarter auto-provisioning
Noticed working on benchmarks that auto provisioning is especially slow on the publish side. I thought the NATS client did some caching of stream lookups but maybe not. It should be pretty simple to ensure auto-provisioning code is only run once (per topic) in the lifetime of a publisher.
Same mechanism won't hurt on subscriber side either so may as well use there also.
The other option is to maybe build flexibility for override of the provisioned stream into SubscribeInitialize I think the kafka middleware might do something similar. Not sure where this would leave the publisher though.
Maybe hold this for v2.1 and new jetstream API. https://natsbyexample.com/examples/jetstream/api-migration/go