Hi,

I'm trying to run some legacy JMS code in TomEE 1.7.0 using the internal
broker:

    <Resource id="JmsResourceAdapter" type="ActiveMQResourceAdapter">
        BrokerXmlConfig =  broker:(tcp://localhost:61616?daemon=true)
        ServerUrl       =  vm://localhost
    </Resource>

In this code the redelivery policy is changed:

QueueConnectionFactory connectionFactory = (QueueConnectionFactory)
initialContext.lookup("openejb:Resource/JmsConnectionFactory");

connection = (ActiveMQConnection) connectionFactory.createQueueConnection();

RedeliveryPolicy redeliveryPolicy = connection.getRedeliveryPolicy();
redeliveryPolicy.setRedeliveryDelay(30000);
connection.setRedeliveryPolicy(redeliveryPolicy);

I'm getting the following exception when I try to cast the connection:
java.lang.ClassCastException: com.sun.proxy.$Proxy156 cannot be cast to
org.apache.activemq.ActiveMQConnection

I guess the best way to solve it would be with a MDB, I saw in the
documentation I can change the redelivery values with it, but I can't
refactor this code right now.

Is it possible to set the redelivery policy in tomee.xml? If not, I noticed
while debugging in Eclipse
that there is a ManagedConnectionProxy instance behind the proxy, and this
class has a physicalConnection property that holds the current
ActiveMQConnection instance. How can I access it?

Thanks

Reply via email to