<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	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"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:int="http://www.springframework.org/schema/integration"
	xmlns:int-jmx="http://www.springframework.org/schema/integration/jmx">


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

	<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/>

	<int-jmx:operation-invoking-channel-adapter
		id="controlChannel"
		object-name="org.springframework.integration.jmx.config:type=SimpleDynamicRouter,name=dynamicRouter"
		operation-name="addChannelMapping" />

	<int:router input-channel="routingChannel" ref="dynamicRouter" method="route"/>

	<bean id="dynamicRouter"
		class="org.springframework.integration.jmx.config.SimpleDynamicRouter">
		<constructor-arg>
			<map>
				<entry key="java.lang.String" value="processAChannel" />
				<entry key="java.lang.Integer" value="processBChannel" />
			</map>
		</constructor-arg>
	</bean>

	<int:channel id="processAChannel">
		<int:queue/>
	</int:channel>

	<int:channel id="processBChannel">
		<int:queue/>
	</int:channel>

	<int:channel id="processCChannel">
		<int:queue/>
	</int:channel>

</beans>
