I have queue channel defined as:
In some code I retrieve the channel via the application context as:
I don't use the PollableChannel interface because I need to call the clear() method on the queue.
QueueChannel myChannel = (QueueChannel ) ctx.getBean("myChannel");
All was good until I tried to add JMX support as:
Since then I get a ClassCastException:
<jmx:mbean-export default-domain="com.mypackage" server="mbeanServer"/>
<beans:bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<beans:property name="locateExistingServerIfPossible" value="true"/>
java.lang.ClassCastException: $Proxy224 cannot be cast to org.springframework.integration.channel.QueueChann el
If I use the interface (PollableChannel) I avoid the error but I can't execute clear() method.
żIs there any way to workaround this get my channel as a QueueChannel?
Thanks in advance.