When configuring mule, you might find out that some of your services need to call external parties. Depending on your deployment scenario there needs to be a proxy server involved. However this might change for various test stages, some need, some don’t, some need them only for specific domains and like that.
To reduce configuration overhead we have created an automatic proxy selector used for our services. Because I think its neat, I want to share it with you.
As you can see we configured a Connector which creates this MessageDispatcherFactory, it passes the configuration obtained from JNDI to it and also adds a keystore for ssl connections to it (with the great default password changeit :-))
Using it is then straightforward:
The Factory itself is dead simple:
The HttpAutoProxyMessageDispatcher implementation is easy was well. And contains a few hardcoded hosts that should not be proxied. Feel free to improve that part:
When you applied this pattern you only need to make sure JNDI information regarding the proxy is correct on each environment, and the mule configuration will automatically adapt to it.
Update: Mule 3.2
Recent Versions of Mule made it even easier to implement the HttpAutoProxyMessageDispatcher:
More articles in this subject area
Discover exciting further topics and let the codecentric world inspire you.
Blog author
Fabian Lange
Do you still have questions? Just send me a message.
Do you still have questions? Just send me a message.