Load Balance for Existing Messaging Service
This is a sample to show how we can change our existing messaging service for requirement or improvement. Here we use a load balance support as example.
Build the sample
Imagine that we have a message handling system built before to collect some information from our client and then process and record them. This scenario can be constructed by using the following XML route configuration.
For more instruction to build your sample, read the Camel Maven Archetypes page. The above routes are the default configuration for your new sample, so you can get started with it easily.
After started, we can view the routes configured in camel context by directing your browser to http://localhost:8080/routes.
Use Web Console to add load balance support
For a handful of small messages, one queue is enough to handle. But when encountering high volumn message input, we may want to use several queues to provide a load balance mechanism. So we can use the camel Load Balancer support. The messaging service improvement here is much easier than that in other messaging system. You can open the routes on the above page.
Let the route2 collect messages from both queues providing the load balance support:
With these two operations, you have complete this work. Just throw your message into the directory, camel will process and deliver it automatically. By the way, you may need some Dead Letter Channel configuration for it since XML analyzing with rigid format usually accompanies frequent error.