My application (Java swing) is becoming quite big and I’m now busy to decouple a few components. In the current situation all my components have references to one or more other components, this works well if the tree of components is small, but becomes difficult to manage when the tree becomes larger (large constructors)
Is it possible to let a sub view send a message of type x that is received by views that registered (at a central hub) that they want to receive message of this type?
Of course this is possible and i can implement it, but it feels a bit like reinventing the wheel.
Are there any libraries / products that might act as a central hub where views can subscribe for message types and where views can also send the messages to?
(please note i did a search on this, but i suspect i don’t know the right English word for this central hub structure/pattern) ( so the correct English word is also OK 😉 )
Your scenario can be addressed using the
Observerpattern that provides the in-process publish-subscribe paradigm toActiveMQ, a messaging system that implements the JMS specification.