I have an MDB that acts as a router. It receives messages from a topic or a queue and forwards them to 0..n queues/topics based on a routing table.
The problem is that this routing table needs to be configured dynamically during runtime. Unfortunately EJB:s are configured through deployment descriptors and within the boundaries of the bean lifecycle. Is there a way around this? Can I have my beans expose a management interface and change the configuration by means of JMX?
The only clean way that I can think of is to have the routing table configuration exist in a database and have the MDB do a number of database queries in its onMessage method to figure out the destinations. Having to do database lookups in onMessage method is a performance killer ofcourse.
Any alternatives? Should I drop the MDB approach and implement the router as a regular MBean?