You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "javier (JIRA)" <ji...@apache.org> on 2010/08/31 07:45:53 UTC

[jira] Commented: (CXF-2550) transactions don't work in jaxws Endpoint with jms transport

    [ https://issues.apache.org/jira/browse/CXF-2550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12904522#action_12904522 ] 

javier commented on CXF-2550:
-----------------------------

Hi Daniel,

Is it possible modify JMSDestination. Modify the onMessage method to propagate the exception without consider TransactionManager. Throw the exception to Spring if there is an exception. "Local resource transactions can simply be activated through the sessionTransacted " according http://static.springsource.org/spring/docs/2.5.x/reference/jms.html. Can work with local resource transaction or with a transaction manager. 

instead 

            //need to propagate any exceptions back to Spring container 
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
            	
     
            	PlatformTransactionManager m = jmsConfig.getTransactionManager();
                if (m != null) {
                    TransactionStatus status = m.getTransaction(null);
                    JmsResourceHolder resourceHolder =
                        (JmsResourceHolder) TransactionSynchronizationManager
                            .getResource(jmsConfig.getConnectionFactory());
                    boolean trans = resourceHolder == null 
                        || !resourceHolder.containsSession(session);
                    if (status != null && !status.isCompleted() && trans) {
                        Exception ex = inMessage.getContent(Exception.class);
                        if (ex.getCause() instanceof RuntimeException) {
                            throw (RuntimeException)ex.getCause();
                        } else {
                            throw new RuntimeException(ex);
                        }
                    }
                }
            }


use


            //need to propagate any exceptions back to Spring container 
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
            	
                Exception ex = inMessage.getContent(Exception.class);
                if (ex.getCause() instanceof RuntimeException) {
                    throw (RuntimeException)ex.getCause();
                } else {
                    throw new RuntimeException(ex);
                }
            }



> transactions don't work in jaxws Endpoint  with jms transport
> -------------------------------------------------------------
>
>                 Key: CXF-2550
>                 URL: https://issues.apache.org/jira/browse/CXF-2550
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.2.4, 2.2.5
>            Reporter: javier
>            Assignee: Daniel Kulp
>         Attachments: jms_queue.zip
>
>
> i'm trying cxf with jms transport with transaction to process a message and it is dequeued  when the implementor object  throw an error .
> the message is inonly and the code is:
> 	EndpointImpl endpoint = new EndpointImpl(new ObjectImpl());
> 	endpoint.setAddress("jms://");
>         ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
>         JMSConfiguration jmsConfig = new JMSConfiguration();
>         jmsConfig.setConnectionFactory(connectionFactory);
>         jmsConfig.setTargetDestination("sso2");
> 	jmsConfig.setSessionTransacted(true);
> 	jmsConfig.setPubSubDomain(false);
> 	jmsConfig.setUseJms11(true);
> 	jmsConfig.setTransactionManager(new JmsTransactionManager(connectionFactory));
> 	JMSConfigFeature jmsConfigFeature = new JMSConfigFeature();
> 	jmsConfigFeature.setJmsConfig(jmsConfig);
> 	endpoint.getFeatures().add(jmsConfigFeature);
> 	endpoint.publish();
> seems that the exception never arrive to  AbstractMessageListenerContainer.doExecuteListener but it is catched inside

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.