Replies: 1 comment 1 reply
-
I think that it is a worthwhile endeavor to consider building this as an actual Microservices connector like in #235. It should force us to create the connection only once in a centralized place as a part of starting up the microservice |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The room for improvement is simple, you have an AmqpConnectionFactory which just creates the connection and init. My proposal is to create a static repo class where we store the active classes (can also be an instance class, not necessary to be static but depends where u want to access so). We would check first if a connection exists for the given config and if so, we return it rather than just create. Also, we could assign a flag whether it connected/initialized so we would avoid invoking init if it's already initialized
I know that the perfect idea is for people to set on the upper level but if you have something like my use case where you have different domains and each domain may or not implement, you wouldn't want to add in the root shared module because this is kinda specific to the modules that really use external rabbit mq services. Therefore I think if @golevelup package can assemble the re-usable of connections, it would be great
The concept is simple, if the connection URI given on the module already exists, we use that instance but if the exchanges passed are not connected we attach them, if any module "unloads" we can just detach that channel and the connection would just be disconnected if there are no more channels rather than the one you are disconnecting
Beta Was this translation helpful? Give feedback.
All reactions