Re: Lazy init for JMS-Component

2015-07-23 Thread jpeschke
Hi,
@Claus: Thanks a lot for your help.

Found a configuration that works, for the record, here it is: 

The JmsComponent must not have "lazy-init=true", because Camel expects the
bean to be there to initialize the route. But with "lookupOnStartup =false"
in the JndiObjectFactoryBean, the JMSConnection is looked up not before it
is actually needed by a route, and therefore camel doesn't freeze (or wait
unnessecary long) on test systems where there is no connection to JMS but a
file consumer endpoint with testdata instead.

Note that you need to set the expectedType property on the JndiObjectfactory
bean if you use "lookupOnStartup=false" so that spring can pass a correct
interface to the JmsComponent:

  



  
 
* 
 *
 


Joerg




--
View this message in context: 
http://camel.465427.n5.nabble.com/Lazy-init-for-JMS-Component-tp5769586p5769823.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Lazy init for JMS-Component

2015-07-21 Thread jpeschke
Hi Claus,
I'm using two routes, one for receiving, the one for sending (for
acknowledging received messages).

The problem is, as I understand it, that the camel route processor needs a
JmsComponent Bean with the id "someQueueBean" to resolve an URL like
"someQueueBean:queue:...", but which isn't there when lazy-init=true.

But I will try to fiddle around with the parameters and see what the result
is. Maybe a "lazy-init=false" on the JmsComponent, but a
lookupOnStartup=false on the JndiObjectFactoryBean does the trick.

Thanks,
Joerg




--
View this message in context: 
http://camel.465427.n5.nabble.com/Lazy-init-for-JMS-Component-tp5769586p5769674.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Lazy init for JMS-Component

2015-07-20 Thread Claus Ibsen
Hi

Are your Camel route starting from JMS, or sending to JMS?
If its the latter, you can use a  instead of  then
the uri is dynamic computed on-demand and you should be able to
startup jms.

Also some of the async options such as asyncStartListener may help.
And setting autoStartup=false etc

On Mon, Jul 20, 2015 at 4:52 PM, jpeschke  wrote:
> Hi all,
> I have a problem with the lazy initialisation of a JMS component:
>
> I have the following Spring configuration (JMS connection factory will be
> looked up via JNDI):
>
> 
>  ref="jmsQueueConnectionFactory" />
> 
>
>  id="jmsQueueConnectionFactory" >
>  
>  
> 
> ...
>
> This works fine so far. The only problem is that this will try to setup the
> JMS connection right at startup. What I want is a solution that starts the
> whole JMS thing at the moment a camel endpoint is created that needs it but
> not before this moment (I need this for integration tests where the
> JMS-endpoints are replaced by file endpoints because the test systems do not
> nessecarily have access to the JMS broker)
>
> So I configured all the beans to "lazy-init=true" and told the
> JNDIObjectFatcory bean to be looked up NOT at startup:
>
>  id="jmsQueueConnectionFactory" lazy-init="true">
>  
>  
>  
> 
>
> This works, but as soon as I setup a Camel route using my "queue" bean, I
> get errors because the camel JMS endpoint cannot find it, so it does not set
> up the JMS connection "on demand", as I would have expected.
>
> Any ideas how to do this right?
>
> Thanks for any ideas.
>
> Best regards,
> Joerg
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Lazy-init-for-JMS-Component-tp5769586.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2


Lazy init for JMS-Component

2015-07-20 Thread jpeschke
Hi all,
I have a problem with the lazy initialisation of a JMS component:

I have the following Spring configuration (JMS connection factory will be
looked up via JNDI):

 


 

  
 

...

This works fine so far. The only problem is that this will try to setup the
JMS connection right at startup. What I want is a solution that starts the
whole JMS thing at the moment a camel endpoint is created that needs it but
not before this moment (I need this for integration tests where the
JMS-endpoints are replaced by file endpoints because the test systems do not
nessecarily have access to the JMS broker)

So I configured all the beans to "lazy-init=true" and told the
JNDIObjectFatcory bean to be looked up NOT at startup:


 
 
 


This works, but as soon as I setup a Camel route using my "queue" bean, I
get errors because the camel JMS endpoint cannot find it, so it does not set
up the JMS connection "on demand", as I would have expected.

Any ideas how to do this right?

Thanks for any ideas.

Best regards,
Joerg



--
View this message in context: 
http://camel.465427.n5.nabble.com/Lazy-init-for-JMS-Component-tp5769586.html
Sent from the Camel - Users mailing list archive at Nabble.com.