<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:si="http://www.springframework.org/schema/integration"
	xmlns:jmx="http://www.springframework.org/schema/integration/jmx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
			https://www.springframework.org/schema/beans/spring-beans.xsd
			http://www.springframework.org/schema/context
			https://www.springframework.org/schema/context/spring-context.xsd
			http://www.springframework.org/schema/integration
			https://www.springframework.org/schema/integration/spring-integration.xsd
			http://www.springframework.org/schema/integration/jmx
			https://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd">

	<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
		<property name="locateExistingServerIfPossible" value="true"/>
	</bean>

	<context:mbean-export server="mbeanServer"/>

	<jmx:tree-polling-channel-adapter id="adapter-default"
			channel="channel1"
			auto-startup="false">
		<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
	</jmx:tree-polling-channel-adapter>

	<si:channel id="channel1">
		<si:queue/>
	</si:channel>

	<jmx:tree-polling-channel-adapter id="adapter-inner"
			channel="channel2"
			auto-startup="false">
		<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
		<bean class="org.springframework.integration.jmx.DefaultMBeanObjectConverter"/>
	</jmx:tree-polling-channel-adapter>

	<si:channel id="channel2">
		<si:queue/>
	</si:channel>

	<jmx:tree-polling-channel-adapter id="adapter-query-name"
			channel="channel3"
			auto-startup="false"
			query-name="java.lang:type=Runtime"
			query-expression="*:type=*">
		<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
	</jmx:tree-polling-channel-adapter>

	<si:channel id="channel3">
		<si:queue/>
	</si:channel>

	<jmx:tree-polling-channel-adapter id="adapter-query-name-bean"
			channel="channel4"
			auto-startup="false"
			query-name-ref="queryName">
		<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
	</jmx:tree-polling-channel-adapter>

	<bean id="queryName" class="javax.management.ObjectName">
		<constructor-arg>
			<value type="java.lang.String">java.lang:type=OperatingSystem</value>
		</constructor-arg>
	</bean>

	<si:channel id="channel4">
		<si:queue/>
	</si:channel>

	<jmx:tree-polling-channel-adapter id="adapter-query-expr-bean"
			channel="channel5"
			auto-startup="false"
			query-expression-ref="queryExp">
		<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
	</jmx:tree-polling-channel-adapter>

	<bean id="queryExp" class="javax.management.ObjectName">
		<constructor-arg>
			<value type="java.lang.String">java.lang:type=Runtime</value>
		</constructor-arg>
	</bean>

	<si:channel id="channel5">
		<si:queue/>
	</si:channel>

	<jmx:tree-polling-channel-adapter id="adapter-converter"
			channel="channel6" converter="converter"
			auto-startup="false">
		<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
	</jmx:tree-polling-channel-adapter>

	<bean id="converter" class="org.springframework.integration.jmx.DefaultMBeanObjectConverter" />

	<si:channel id="channel6">
		<si:queue/>
	</si:channel>

</beans>
