spring-nats
spring-nats copied to clipboard
Ideas: drain with close, connection bean without real connection
Hi guys,
After usage of nats java client with spring-boot-starter I found such inconvenient moments:
-
Connection implements Autoclosable and it's called during Spring Applicaiton Shutdown but I'm expecting that
drain()
will be called as well. In this case I need to implement some SpringDispoasableBean
and call drain there. 😞 Proposal: includedrain()
inclose()
. -
I have an application that uses Nats. That part of the application is not critical and it's ok if for some period that Nats Cluster will be down. So if Nats Cluster is not up and running I can't:
- start application
- scale-up already running application
because
Nats.connect()
will throw an exception and my spring context will not be constructed and application startup fail. Proposal: Maybe return some lazy connection that will try to connect during call some of its interface. But here could be a problem with subscribers that should be created for example in@PostConstruct
method.