Hi all,

We're trying to customize DestinationResolver as below as camel JmsComponent
doc page suggested, but could not cast the session parameter to
MQQueueSession. The print line displays the class of the session passed in
is of class $proxy40.

Does anyone out there have a clue on what we do wrong or anything is
missing?

Thanks in advance for any help or hint.

======================================
public class MQDestinationResolver implements DestinationResolver
{
    @Override
    public Destination resolveDestinationName(Session session, String
destinationName, 
                                                              boolean
pubSubDomain) throws JMSException {

        System.out.println("session class: " +
session.getClass().getName());

        //session.
        MQQueueSession wmqSession = (MQQueueSession) session;

.....
}
========================================
<?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
http://www.springframework.org/schema/beans/spring-beans.xsd
                                          
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

    <bean id="jmsConnectionFactoryTEST"
class="com.ibm.mq.jms.MQXAQueueConnectionFactory">
        <property name="hostName" value="${mqdef0.hostName}" />
        <property name="port" value="${mqdef0.port}" />
        <property name="queueManager" value="${mqdef0.queueManager}" />
        <property name="channel" value="${mqdef0.channel}" />
        <property name="transportType" value="${mqdef0.transportType}" />
    </bean>
        
    <bean id="cachedConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
        <property name="targetConnectionFactory"
ref="jmsConnectionFactoryTEST"/>
        <property name="sessionCacheSize" value="10" />
    </bean>

    <bean id="jmsConfigTEST"
class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="connectionFactory" ref="cachedConnectionFactory" />
        <property name="transactionManager" ref="JtaTransactionManager"/>
    </bean>

    <bean id="jmsComponentTEST"
class="org.apache.camel.component.jms.JmsComponent">
        <property name="configuration" ref="jmsConfigTEST" />
        <property name="destinationResolver" ref="destinationResolver"/>
    </bean>

    <bean id="destinationResolver" class="MQDestinationResolver"/>
</beans>



--
View this message in context: 
http://camel.465427.n5.nabble.com/Customizing-DestinationResolver-for-JmsComponent-got-proxy40-as-session-tp5745850.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to