You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ctapobep <st...@gmail.com> on 2011/07/04 13:13:17 UTC

ProducerTemplate is not started

Dunno why, but from time to time my integration tests fail with:

/java.lang.IllegalStateException: ProducerTemplate has not been started
	at
org.apache.camel.impl.DefaultProducerTemplate.getProducerCache(DefaultProducerTemplate.java:674)
	at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:114)
	at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:101)/

Have no slightest clue what's wrong.. On Friday everything seemed to work.
Monday ruines peoples lives..

--
View this message in context: http://camel.465427.n5.nabble.com/ProducerTemplate-is-not-started-tp4549701p4549701.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ProducerTemplate is not started

Posted by ctapobep <st...@gmail.com>.
Mmh.. In future there might be a lot of places, so I don't think it's a good
idea (though Camel context is up and running because server gets the
messages, the error happens when it tries to send them). 
I tried to explicitely invoke ProducerTemplate#start() before sending, and
it's the same - it was trying to start for some seconds, after that test
crashed and destroyed the context. And the error was the same:
ProducerTemplate has not been started.
It just might make sense to save a state of the template: NOT_STARTED,
STARTED, STOPPED so that error messages will be more readable and less
misleading.

--
View this message in context: http://camel.465427.n5.nabble.com/ProducerTemplate-is-not-started-tp4549701p4552623.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ProducerTemplate is not started

Posted by Willem Jiang <wi...@gmail.com>.
Camel JMS sending is based on Spring. The connector is created before 
the producer is started. Can you check the CamelContext states before 
you using ProducerTemplate to send the request ?

On Mon Jul  4 20:38:21 2011, ctapobep wrote:
> No, it's 2.7 :) So it looks like the connection is too slow today on my
> machine and Camel spends too much time to initiate the connection with
> broker while first sendin(!). My test thinks that it's too late and
> application doesn't respond and closes everything down. And now the magic
> happens - there were messages Camel was going to send and while shutting
> down they it tries to send them again, but ProducerTemplate is stopped
> already (spring context is shutting down). This is how I see the situation.
> So what I think is not correct here:
> 1. Camel tries to initiate connection only when first message comes. I guess
> this can be cured somehow by configuring Camel in some particular way..
> 2. Camel shows 'ProducerTemplate has not been started' instead of
> 'ProducerTemplate has been stopped'. I deem this is really a misleading
> behaviour...
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerTemplate-is-not-started-tp4549701p4549867.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: ProducerTemplate is not started

Posted by ctapobep <st...@gmail.com>.
No, it's 2.7 :) So it looks like the connection is too slow today on my
machine and Camel spends too much time to initiate the connection with
broker while first sendin(!). My test thinks that it's too late and
application doesn't respond and closes everything down. And now the magic
happens - there were messages Camel was going to send and while shutting
down they it tries to send them again, but ProducerTemplate is stopped
already (spring context is shutting down). This is how I see the situation.
So what I think is not correct here:
1. Camel tries to initiate connection only when first message comes. I guess
this can be cured somehow by configuring Camel in some particular way..
2. Camel shows 'ProducerTemplate has not been started' instead of
'ProducerTemplate has been stopped'. I deem this is really a misleading
behaviour...

--
View this message in context: http://camel.465427.n5.nabble.com/ProducerTemplate-is-not-started-tp4549701p4549867.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ProducerTemplate is not started

Posted by Jon Anstey <ja...@gmail.com>.
What version of Camel are you using? Wondering if you are using a SNAPSHOT
such that the code may have changed since Friday :)

On Mon, Jul 4, 2011 at 8:43 AM, ctapobep <st...@gmail.com>wrote:

> Dunno why, but from time to time my integration tests fail with:
>
> /java.lang.IllegalStateException: ProducerTemplate has not been started
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.getProducerCache(DefaultProducerTemplate.java:674)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:114)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:101)/
>
> Have no slightest clue what's wrong.. On Friday everything seemed to work.
> Monday ruines peoples lives..
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/ProducerTemplate-is-not-started-tp4549701p4549701.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Cheers,
Jon
---------------
FuseSource
Email: jon@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen