On 08/02/2008, Magnus Heino <[EMAIL PROTECTED]> wrote:
> >
> > > It seems as if I am missing something fundamental here? I feel the smell
> > of
> > > a new user rtfm problem, but where is it? :)
> >
> > :) No I think there maybe some MessageListenerContainer configuration
> > gremlin you're hitting (though its really bizarre that things work
> > fine for JMS transactions, but not when switching to XA!)
> >
> > Camel tries its best to setup the various Spring objects right for you
> > without you having to set zillions of properties up; but maybe there's
> > some gremlin in there that needs fixing...
> >
> >
> > > How is my JmsComponent looked up by camel?
> >
> > So the CamelContext looks up in the Spring AppContext to see if
> > there's an endpoint for the URI, if not it takes the URI scheme (e.g.
> > jms) and looks up if there's a Component registered for that name and
> > uses that component to create the endpoint.
>
>
> So my JmsComponent needs to be named jms? My was unnamed i.e. I didn't
> provide a spring id.

Ah sorry! My bad - I'd missed that you'd not configured the
JmsComponent with an ID of "jms". DOH!

We've tried to minimise the amount of Spring XML configuration
required in Camel by adding some 'convention over configuration rules'
- but I guess sometimes this magic trips folks up.



> If I give my JmsComponent instance in spring the id "jms", I get these
> errors; Notice the Message received: 'demo'  in the beginning, messages are
> consumed now, they are removed from ems too, even when I shutdown JBoss.
>
> 15:06:24,812 INFO  [Server] JBoss (MX MicroKernel) [4.2.2.GA (build:
> SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 12s:408ms
> 15:06:24,859 INFO  [STDOUT] 2008-02-08 15:06:24,859
> [DefaultMessageListenerContainer-1] INFO  Message received: 'demo' at
> se.lantmateriet.origo.service.internal.UpdateServiceImpl.handleMessage(
> UpdateServiceImpl.java:34)
> 15:06:24,890 INFO  [STDOUT] 2008-02-08 15:06:24,890
> [DefaultMessageListenerContainer-2] ERROR Setup of JMS message listener
> invoker failed - trying to recover at
> org.springframework.jms.listener.DefaultMessageListenerContainer.handleListenerSetupFailure
> (DefaultMessageListenerContainer.java:671)
> javax.jms.IllegalStateException: The connection is closed
>     at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.checkClosed(
> JmsSessionFactoryImpl.java:413)
>     at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createSession(
> JmsSessionFactoryImpl.java:368)
>     at org.springframework.jms.support.JmsAccessor.createSession(
> JmsAccessor.java:200)
>     at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.access$200
> (AbstractPollingMessageListenerContainer.java:76)
>     at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer$MessageListenerContainerResourceFactory.createSession
> (AbstractPollingMessageListenerContainer.java:477)
>     at
> org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession
> (ConnectionFactoryUtils.java:282)
>     at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute
> (AbstractPollingMessageListenerContainer.java:279)
>     at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute
> (AbstractPollingMessageListenerContainer.java:235)
>     at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener
> (DefaultMessageListenerContainer.java:887)
>     at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run
> (DefaultMessageListenerContainer.java:822)
>     at java.lang.Thread.run(Thread.java:595)
> 15:06:24,906 INFO  [STDOUT] 2008-02-08 15:06:24,906
> [DefaultMessageListenerContainer-2] INFO  Successfully refreshed JMS
> Connection at
> org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful
> (DefaultMessageListenerContainer.java:712)
>
> If I add <property name="cacheLevelName" value="CACHE_NONE" />, things seems
> to work!!!!! :-)

YAY! We got there in the end! :)


So in summary; the main issue was not using the id="jms" for the JMS
component configuration - and it seems for XA that we cannot use the
CACHE_CONNECTION / CACHE_CONSUMER.

I guess when we are auto-creating the JMSComponent, we could be nice
and look in spring.xml and see if there's a single bean available of
type JMSComponent and if so, use that. But maybe thats a step too far
in the level of magic?

But then I guess camel was just creating a default JMSComponent under
the covers and injecting the ConnectionFactory itself maybe - which
could be a bit too much magic maybe?


> I guess so, but I don't understand if this is expected behaviour, or a bug?
> :)

I didn't realise CACHE_NONE was mandatory for XA based JMS with
Spring. I guess we can make that the default to avoid others hitting
this bug...


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to