This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Accessing Dynamic Router Capabilities from XML Configured Routers

Jan 20th, 2012, 02:16 PM

Hey guys,

I'm looking for a way to access the dynamic router capabilities of the built-in routers programmatically. I know that classes such as HeaderValueRouter expose setChannelMapping() and removeChannelMapping(), but I have not been able to find a clean way to obtain a reference to an instance of this class from a header-value-router bean.

I know that I can extend EventDrivenConsumer and initialize it with my own instance of a HeaderValueRouter (or derived type), but this feels a little too tightly bound to framework.

My use case is that I want to configure a router statically, but then modify it at run time.

Comment

Our basic problem can probably be solved by just manually creating a bean for the HeaderValueRouter, but tying in the <control-bus /> or using JMX may actually be better for our overall design. So far JMX integration isn't something my team has not explored much. As with the control bus, we'll have to play with it a little more to see exactly what we can do with it -particularly since both methods seem to simplify many of our run-time reconfiguration concerns.