I have created this Camel routes
from("direct:pageExtraction")
.bean(PageManager.class, "setProperties(*, ${headers})")
.filter().method(PageManager.class, "exists").to("seda:pagePostProcessing").end()
.to("seda:pageImposition");
from("seda:pagePostProcessing")
.bean(PageManager.class, "extractThumbnail(*, ${headers})")
.bean(PageManager.class, "extractCMYKSeparation(*, ${headers})")
.bean(PageManager.class, "persist(*, ${headers})")
.bean(PageManager.class, "cleanUp(${headers})")
.to("seda:pageImposition");
from("seda:pageImposition")
.bean(PageManager.class, "extractImposition(*, ${headers})")
.to("seda:printQueue");
At the end, the seda:printQueue has no consumers, sending a message in a route like this apparently works fine. Now I want to introduce a new consumer after the routes have been initialized, I thought it would be possible to create a Spring bean programmatically and let Camel pick up the bean using the @Consume(uri="seda:printQueue")
annotation, but as soon as I create the consumer Camel complains
org.apache.camel.RuntimeCamelException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '4965d710-b5c7-41cf-97e9-a42bdfcea894' is defined]
Any thoughts?
[UPDATE]
I have traced back the error to the class where this new consumer is created, I'm instantiating the PrintQueue
class and then integrating it to the Spring context using an AutowireCapableBeanFactory
doing a factory.autowireBean(printQueueInstance)
followed by factory.initializeBean(printQueueInstance, id)
where id
is the 4965d710-b5c7-41cf-97e9-a42bdfcea894
that appears in the exception above, so I think this has to be some kind of context scope problem, may be I am creating this bean in the main or web Spring context and it can't be access by the Camel context, is this possible?
@Consume
-ing bean? Is it going into the registry? Is there any reason to create it at runtime rather than configure it in advance? – bdeniker