A Camel JMX consumer that connects to a JMX server on the network currently needs the JMX server to be active before the consumer is started. The consumer also has no ability to re-initialize lost connections to the JMX server.
The attached patch eliminates the timing dependency between the JMX consumer and JMX server, by allowing the JMX consumer to optionally poll for the JMX server connection at startup. The patch also allows the consumer to optionally re-initialize (via polling) connections to a JMX server after an active connection is broken.
The patch enables the following URI parameters for JMX consumers :
- testConnectionOnStartup – if true the consumer will throw an exception if unable to establish the JMX connection upon startup. If false, the consumer will attempt to establish the JMX connection every 'x' seconds until the connection is made – where 'x' is the configured reconnectDelay. Default is true.
- reconnectOnConnectionFailure – If true the consumer will attempt to reconnect to the JMX server when any connection failure occurs. The consumer will attempt to re-establish the JMX connection every 'x' seconds until the connection is made-- where 'x' is the configured reconnectDelay. Default is false.
- reconnectDelay – The number of seconds to wait before attempting to retry establishment of the initial connection or attempt to reconnect a lost connection. Default is 10 seconds.