Re: ActiveMQ redelivery policy

2014-08-27 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Feilpe,

I think you meant to post to the tomee-users mailing list. You got
tomcat-users.

- -chris

On 8/26/14, 4:31 PM, Felipe Jaekel wrote:
 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(3); 
 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
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJT/kf7AAoJEBzwKT+lPKRYR3gQALr4G/ws1bPODbpTJbFg6ESM
M7qIIle8Dnze44pdJDf8bIbGVsJnS7QG7Q/064mp0sNw44oqR9k+EF/oFBhNC9bs
khbBiCJM69MJLYGBx17ZcuFty56IT/dHWN84ghMBcz1W/1Od/toSOAI+wR79dLBh
EHVQMOAGXzft0yb6SLwyUllCjqm2PYg9lN12UCm9fd6YFkxLjNwP291gRvvCPjtz
kArIbVP3/Nekv9p9nq7cdmLc2oriaOZmeLy91JgUmDT+kH9UwEjgMQScyRnqf9TA
ayU1h9zbZh3Vvx2/8Y10WIr4R5kk3vh9/+YLIMKsQi8dG9It6/mnf8AOuq6j2uVI
dIeGElbb1ZM+oeqTFHl1HcwIIuZrWFFWb3uyOAuxZ8Ss1ieLc9q/a9k2eSA2qP81
h62q5XDT5B7OTM8oR9IEg8OdV/gLK+F+nhKn0baDAHShnZqQqWjN4mKB6sP8hjko
crW3ek5yiCKLY0tZRb8c7AfDDTglOKg1C/fdezXLP2OMZzUnIWsHrMAN1uzmBwRB
dsTqXccQCXrZaVrNaEEJdHIGuCz4pMJAK2gAjEKZgL6uoCFHFi8BBmv4qAhF3k8b
hv/C3hSyudNo3Q+QBdORtewxj5ROlm8zBRET6ZkGiSMYgZI7rMa3bkUVfaaQNNO5
Qa+LUioRvpqpRVPQfR3d
=sMEN
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



ActiveMQ redelivery policy

2014-08-26 Thread Felipe Jaekel
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(3);
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