I have a module that has providers for consuming and publishing messages to a rabbitmq queue, let's call it ModuleA.
In addition, I have another module that has a provider that updates and reads from a DB, let's call it ModuleB.
When a message is consumed from rabbitmq, a DB action needs to happen with the help of a relevant provider from ModuleB..
Similarly, when a specific controller endpoint (the controller is in moduleB) is called, a message needs to be published to the rabbitmq queue with the help of a relevant provider from ModuleA.
So, here's my options:
- Make use of forwardRef so that each module imports the other one.
- Use the same providers for both modules (which don't rely on each other in and of themselves)
- Something else? Third module maybe somehow?
I would like to know what might be the best practice for this kind of situation and if options 1 and 2 are even good options at all