Hi Gary, configuring sync send works great and results in the expected behaviour of Camel (i.e. the transaction is rolled back).
Thanks, Holger Gary Tully wrote: > > If you can configure sync send on the connection factory, can do it > via the brokerURL: > vm://localhost?jms.alwaysSyncSend=true > then the send exception will bubble back up to camel. The exception on > creating the producer will still be there as that is always send > async. > A standard javax.jms.ExceptionListener would be called if one was > registered when the async exception are received from the broker. > > On 30 July 2010 13:04, Holger_ <[email protected]> wrote: >> >> Hi, >> >> I started this topic on the camel-user list but was referred to this >> list: >> http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2256668.html >> >> I have a very simple Camel route consuming messages from an Active MQ >> queue >> and sending them to another one. The whole route should be transactional, >> i.e. either the message is consumed and sent successfully or this process >> is >> rolled back: >> >> from("activemq:queue:foo") >> .transacted() >> .to("activemq:queue:bar2"); >> >> foo is accessible by the user but bar2 is not accessible. When I send a >> message to the foo queue I get the following output: >> >> DEBUG DefaultMessageListenerContainer-1 >> org.apache.camel.component.jms.EndpointMessageListener - >> Endpoint[activemq://queue:foo] consumer receiving JMS message: >> ActiveMQTextMessage {commandId = 6, responseRequired = false, messageId = >> ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1, originalDestination = null, >> originalTransactionId = null, producerId = >> ID:HOLGERSNB-2175-1280308413512-2:61:1:1, destination = queue://foo, >> transactionId = TX:ID:HOLGERSNB-2175-1280308413512-2:61:1, expiration = >> 0, >> timestamp = 1280308435389, arrival = 0, brokerInTime = 1280308435389, >> brokerOutTime = 1280308435405, correlationId = null, replyTo = null, >> persistent = true, type = null, priority = 4, groupID = null, >> groupSequence >> = 0, targetConsumerId = null, compressed = false, userID = null, content >> = >> null, marshalledProperties = null, dataStructure = null, >> redeliveryCounter = >> 0, size = 1039, properties = null, readOnlyProperties = true, >> readOnlyBody = >> true, droppable = false, text = Hello World} >> DEBUG DefaultMessageListenerContainer-1 >> org.apache.camel.spring.spi.TransactionErrorHandler - Transaction begin >> (0x1ca1837) for ExchangeId: ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1 >> DEBUG DefaultMessageListenerContainer-1 >> org.apache.camel.processor.SendProcessor - >>>> >> Endpoint[activemq://queue:bar2] Exchange[JmsMessage: ActiveMQTextMessage >> {commandId = 6, responseRequired = false, messageId = >> ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1, originalDestination = null, >> originalTransactionId = null, producerId = >> ID:HOLGERSNB-2175-1280308413512-2:61:1:1, destination = queue://foo, >> transactionId = TX:ID:HOLGERSNB-2175-1280308413512-2:61:1, expiration = >> 0, >> timestamp = 1280308435389, arrival = 0, brokerInTime = 1280308435389, >> brokerOutTime = 1280308435405, correlationId = null, replyTo = null, >> persistent = true, type = null, priority = 4, groupID = null, >> groupSequence >> = 0, targetConsumerId = null, compressed = false, userID = null, content >> = >> null, marshalledProperties = null, dataStructure = null, >> redeliveryCounter = >> 0, size = 1039, properties = null, readOnlyProperties = true, >> readOnlyBody = >> true, droppable = false, text = Hello World}] >> DEBUG DefaultMessageListenerContainer-1 >> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate - >> Executing >> callback on JMS Session: ActiveMQSession >> {id=ID:HOLGERSNB-2175-1280308413512-2:64:1,started=false} >> WARN VMTransport org.apache.activemq.broker.TransportConnection.Service - >> Async error occurred: java.lang.SecurityException: User user is not >> authorized to write to: queue://bar2 >> java.lang.SecurityException: User user is not authorized to write to: >> queue://bar2 >> at >> org.apache.activemq.security.AuthorizationBroker.addProducer(AuthorizationBroker.java:159) >> at >> org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:97) >> at >> org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:494) >> at >> org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105) >> at >> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300) >> at >> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178) >> at >> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116) >> at >> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68) >> at >> org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210) >> at >> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122) >> at >> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43) >> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown >> Source) >> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown >> Source) >> at java.lang.Thread.run(Unknown Source) >> DEBUG DefaultMessageListenerContainer-1 >> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate - >> Sending >> JMS message to: queue://bar2 with message: ActiveMQTextMessage {commandId >> = >> 0, responseRequired = false, messageId = null, originalDestination = >> null, >> originalTransactionId = null, producerId = null, destination = null, >> transactionId = null, expiration = 0, timestamp = 0, arrival = 0, >> brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = >> null, >> persistent = true, type = null, priority = 4, groupID = null, >> groupSequence >> = 0, targetConsumerId = null, compressed = false, userID = null, content >> = >> null, marshalledProperties = null, dataStructure = null, >> redeliveryCounter = >> 0, size = 0, properties = {CamelJmsDeliveryMode=2}, readOnlyProperties = >> false, readOnlyBody = false, droppable = false, text = Hello World} >> WARN VMTransport org.apache.activemq.broker.TransportConnection.Service - >> Async error occurred: java.lang.SecurityException: User user is not >> authorized to write to: queue://bar2 >> java.lang.SecurityException: User user is not authorized to write to: >> queue://bar2 >> at >> org.apache.activemq.security.AuthorizationBroker.send(AuthorizationBroker.java:182) >> at >> org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:133) >> at >> org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:446) >> at >> org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:631) >> at >> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300) >> at >> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178) >> at >> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116) >> at >> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68) >> at >> org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210) >> at >> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122) >> at >> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43) >> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown >> Source) >> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown >> Source) >> at java.lang.Thread.run(Unknown Source) >> DEBUG DefaultMessageListenerContainer-1 >> org.apache.camel.spring.spi.TransactionErrorHandler - Transaction commit >> (0x1ca1837) for ExchangeId: ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1 >> WARN VMTransport org.apache.activemq.broker.TransportConnection.Service - >> Async error occurred: java.lang.IllegalStateException: Cannot remove a >> producer that had not been registered: >> ID:HOLGERSNB-2175-1280308413512-2:64:1:1 >> java.lang.IllegalStateException: Cannot remove a producer that had not >> been >> registered: ID:HOLGERSNB-2175-1280308413512-2:64:1:1 >> at >> org.apache.activemq.broker.TransportConnection.processRemoveProducer(TransportConnection.java:515) >> at >> org.apache.activemq.command.RemoveInfo.visit(RemoveInfo.java:78) >> at >> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300) >> at >> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178) >> at >> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116) >> at >> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68) >> at >> org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210) >> at >> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122) >> at >> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43) >> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown >> Source) >> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown >> Source) >> at java.lang.Thread.run(Unknown Source) >> INFO DefaultMessageListenerContainer-1 >> org.springframework.jms.listener.DefaultMessageListenerContainer - Setup >> of >> JMS message listener invoker failed for destination 'bar2' - trying to >> recover. Cause: User user is not authorized to read from: queue://bar2 >> INFO DefaultMessageListenerContainer-1 >> org.springframework.jms.listener.DefaultMessageListenerContainer - >> Successfully refreshed JMS Connection >> INFO DefaultMessageListenerContainer-2 >> org.springframework.jms.listener.DefaultMessageListenerContainer - Setup >> of >> JMS message listener invoker failed for destination 'bar2' - trying to >> recover. Cause: User user is not authorized to read from: queue://bar2 >> INFO DefaultMessageListenerContainer-2 >> org.springframework.jms.listener.DefaultMessageListenerContainer - >> Successfully refreshed JMS Connection >> >> >> The problem is that the message is consumed from the foo-queue and not >> rolled back within the transaction (the transaction commits before >> sending >> the message to the bar-queue). This seems to happen because the >> SecurityException exception is not propagated to Camel. >> >> Is there anything I am doing wrong? >> >> Thanks, >> Holger >> -- >> View this message in context: >> http://old.nabble.com/SecurityException-not-delegated-to-Camel--tp29305408p29305408.html >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. >> >> > > > > -- > http://blog.garytully.com > > Open Source Integration > http://fusesource.com > > -- View this message in context: http://old.nabble.com/SecurityException-not-delegated-to-Camel--tp29305408p29334555.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.
