In the previous post (Extend ServiceMix Management features using Spring – Part 1) I demonstrated a very simple technique that allows you to expose endpoint lifecycle operations via jmx. Now I am going to take it one step further and expose the endpoint configuration via jmx.
If you haven’t done already please catch up by reading Part 1.
Part II: Modifying the configuration of a live endpoint.
Open the HttpEndpointManager and delegate the getter and setter of HttpEndpoints locationURI property.
Annotate both methods with @ManagedAttribute
Once the assembly gets deployed from the jmx console the locationURI property is exposed.
Note that once the new property is applied, the endpoint needs to be reactivated (call deactivate and activate from jmx as shown in the previous post).
As you can see in the picture I used jmx and changed the location uri from PersonService to NewPersonService, without editing, recompiling or redeploying the service assembly.
The full source code of this example can be found here.
In the Part 3 I will demonstrate how these changes in the configuration can be persisted and how we can intercept endpoints lifecycle so that we have those changes loaded each time the endpoint starts.