Camel Component: JMX - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

Component allows consumers to subscribe to an mbean's Notifications. The component supports passing the Notification object directly through the Exchange or serializing it to XML according to the schema provided within this project. This is a consumer only component. Exceptions are thrown if you attempt to create a producer for it.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
   <groupId>org.apache.camel</groupId>
   <artifactId>camel-jmx</artifactId>
   <!-- use the same version as your Camel core version -->
   <version>x.x.x</version>
</dependency>

URI Format and Options

The component can connect to the local platform mbean server with the following URI:

jmx://platform?options

A remote mbean server url can be provided following the initial JMX scheme like so:

jmx:service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi?options

You can append query options to the URI in the following format, ?options=value&option2=value&..., where option can be:

Table 12. 

Property

Required

Default

Description

format

no

xml

Format for the message body. Either "xml" or "raw". If xml, the notification is serialized to xml. If raw, then the raw java object is set as the body.

user

no 

 

Credentials for making a remote connection.

password

no 

 

Credentials for making a remote connection.

objectDomain

yes

 

The domain for the mbean you're connecting to.

objectName

no 

 

The name key for the mbean you're connecting to. This value is mutually exclusive with the object properties that get passed. (see below)

notificationFilter

no 

 

Reference to a bean that implements the NotificationFilter. The #ref syntax should be used to reference the bean via the Registry.

handback

no 

 

Value to handback to the listener when a notification is received. This value will be put in the message header with the key "jmx.handback"

testConnection-OnStartup

true

Starting with Camel 2.11, if true, the consumer will throw an exception when 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 using the reconnectDelay option.

reconnectOn-ConnectionFailure

false

Starting with Camel 2.11, 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 using the reconnectDelay option.

reconnectDelay

10 seconds

Starting with Camel 2.11, the number of seconds to wait before retrying creation of the initial connection or before reconnecting a lost connection.


ObjectName Construction

The URI must always have the objectDomain property. In addition, the URI must contain either objectName or one or more properties that start with "key."

Domain with Name property

When the objectName property is provided, the following constructor is used to build the ObjectName? for the mbean:

ObjectName(String domain, String key, String value)

The key value in the above will be "name" and the value will be the value of the objectName property.

Domain with Hashtable

ObjectName(String domain, Hashtable<String,String> table)

The Hashtable is constructed by extracting properties that start with "key." The properties will have the "key." prefixed stripped prior to building the Hashtable. This allows the URI to contain a variable number of properties to identify the mbean.

Example

from("jmx:platform?objectDomain=jmxExample&key.name=simpleBean").
   to("log:jmxEvent");

A full example is here.