[
https://issues.apache.org/jira/browse/CAMEL-10199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15399407#comment-15399407
]
John Mark commented on CAMEL-10199:
-----------------------------------
The camel context is created in camel spring xml so starting it is done by
spring. The producer template is injected into a bean that is automatically
created by spring using package scanning. Then bean is used as a
javax.jms.MessageListener and is called automatically by the spring
DefaultMessageListenerContainer to process JMS messages. (I know that I can
have Camel handle the JMS listening, but the architecture we are using does not
allow for that so I use spring's DefaultMessageListenerContainer to pull
messages off JMS and then push them to camel with the producer template.
If I start the app with messages already on the queue then I get the producer
template not started error.
I should also mention that the application is wired using spring boot (although
I am not using camel-spring-boot for the camel part due to other issues).
> EndpointInject injects not started ProducerTemplate
> ---------------------------------------------------
>
> Key: CAMEL-10199
> URL: https://issues.apache.org/jira/browse/CAMEL-10199
> Project: Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 2.17.2
> Reporter: John Mark
> Priority: Minor
>
> I use Camel with Spring framework and create my routes as spring beans. I use
> {{<camel:ContextScan/>}} to have my routes started.
> The problem I have is that the {{ProducerTemplate}} that is injected into my
> bean (a different bean - not the route bean) using {{@EndpointInject}} is not
> ready for use. When I try to call producerTemplate.send() I get:
> {noformat}
> IllegalStateException: ProducerTemplate has not been started
> {noformat}
> I am using {{?block=true}} in the uri when I call producerTemplate.send()
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)