-
1. Re: Iterable endpoint not working
davsclaus Dec 11, 2009 12:34 AM (in response to unwired)Its not a bug its because you timer fires before the routes are started.
Use a delay on the timer to let it wait a few secs before firing
In Camel 2.1 you can control the order in which routes are started
http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html
And therefore you would be able to set the timer to start last.
-
2. Re: Iterable endpoint not working
unwired Dec 13, 2009 5:40 PM (in response to davsclaus)Adding a delay did not make a difference
from("timer://foo?delay=10000&fixedRate=true&period=60000").multicast().to(xxxx);
Same errors
[org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:yyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:zyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.processor.MulticastProcessor] : Done sequientel processing 2 exchanges
-
3. Re: Iterable endpoint not working
njiang Dec 13, 2009 8:11 PM (in response to unwired)Which version of Camel are you using?
Can you just change the configure's order like this ?
public void configure() throws Exception { Endpoint [] xxxx = new Endpoint[2]; xxxx[0]=new DirectEndpoint("direct:yyyy"); xxxx[1]=new DirectEndpoint("direct:zyyy"); from("direct:yyyy").process(new Processor() { public void process(Exchange arg0) throws Exception { logger.info("date " + new Date()); } }); from(xxxx[1]).process(new Processor() { public void process(Exchange arg0) throws Exception { logger.info("second date " + new Date()); } }); from("timer://foo?delay=10000&fixedRate=true&period=60000").multicast().to(xxxx); }
-
4. Re: Iterable endpoint not working
unwired Dec 13, 2009 8:59 PM (in response to njiang)Changed the order. No difference. Camel 2.0.0 is the version I am using.
See detailed log below
[org.apache.camel.impl.DefaultCamelContext] : JMX enabled. Using InstrumentationLifecycleStrategy. [org.apache.camel.impl.DefaultCamelContext] : Adding routes from builder: Routes: [] [org.apache.camel.impl.DefaultCamelContext] : Apache Camel 2.0.0 (CamelContext:camel-1) is starting [org.apache.camel.impl.DefaultProducerServicePool] : Starting service pool: org.apache.camel.impl.DefaultProducerServicePool@17a29a1 [org.apache.camel.management.DefaultInstrumentationAgent] : Starting JMX agent on server: com.sun.jmx.mbeanserver.JmxMBeanServer@4cee32 [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=context,name="camel-1" [org.apache.camel.impl.DefaultComponentResolver] : Found component: direct via type: org.apache.camel.component.direct.DirectComponent via: META-INF/services/org/apache/camel/component/direct [org.apache.camel.impl.DefaultComponent] : Creating endpoint uri=[direct://yyyy], path=[yyyy], parameters=[{}] [org.apache.camel.impl.DefaultCamelContext] : direct://yyyy converted to endpoint: Endpoint[direct://yyyy] by component: org.apache.camel.component.direct.DirectComponent@1175422 [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=endpoints,name="direct://yyyy" [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=processors,nodeid=process1,name="process[test.VCSRRouteBuilder$1@18f5824]" [org.apache.camel.impl.DefaultComponent] : Creating endpoint uri=[direct://zyyy], path=[zyyy], parameters=[{}] [org.apache.camel.impl.DefaultCamelContext] : direct://zyyy converted to endpoint: Endpoint[direct://zyyy] by component: org.apache.camel.component.direct.DirectComponent@1175422 [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=endpoints,name="direct://zyyy" [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=processors,nodeid=process2,name="process[test.VCSRRouteBuilder$2@102799c]" [org.apache.camel.impl.DefaultComponentResolver] : Found component: timer via type: org.apache.camel.component.timer.TimerComponent via: META-INF/services/org/apache/camel/component/timer [org.apache.camel.impl.DefaultComponent] : Creating endpoint uri=[timer://foo?delay=10000&fixedRate=true&period=60000], path=[foo], parameters=[{delay=10000, fixedRate=true, period=60000}] [org.apache.camel.impl.DefaultPackageScanClassResolver] : Searching for annotations of org.apache.camel.Converter in packages: [org.apache.camel.component.file, org.apache.camel.converter, org.apache.activemq.camel.converter, org.apache.camel.spring.converter] [org.apache.camel.impl.DefaultPackageScanClassResolver] : Loading from jar: C:\Servers\apache-camel-2.0.0\lib\camel-core-2.0.0.jar [org.apache.camel.impl.DefaultPackageScanClassResolver] : Loading from jar: C:\Servers\apache-camel-2.0.0\lib\camel-core-2.0.0.jar [org.apache.camel.impl.DefaultPackageScanClassResolver] : Loading from jar: C:\Temp\activemq\activemq-core-5.1.0.jar [org.apache.camel.impl.DefaultPackageScanClassResolver] : Found: [class org.apache.camel.component.file.GenericFileConverter, class org.apache.camel.converter.CamelConverter, class org.apache.camel.converter.CollectionConverter, class org.apache.camel.converter.IOConverter, class org.apache.camel.converter.NIOConverter, class org.apache.camel.converter.ObjectConverter, class org.apache.camel.converter.jaxp.DomConverter, class org.apache.camel.converter.jaxp.StaxConverter, class org.apache.camel.converter.jaxp.StreamSourceConverter, class org.apache.camel.converter.jaxp.XmlConverter, class org.apache.camel.converter.stream.StreamCacheConverter, class org.apache.activemq.camel.converter.ActiveMQConverter, class org.apache.activemq.camel.converter.ActiveMQMessageConverter] [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.component.file.GenericFileConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.CamelConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.CollectionConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.IOConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.NIOConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.ObjectConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.jaxp.DomConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.jaxp.StaxConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.jaxp.StreamSourceConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.jaxp.XmlConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.camel.converter.stream.StreamCacheConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.activemq.camel.converter.ActiveMQConverter [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] : Loading converter class: org.apache.activemq.camel.converter.ActiveMQMessageConverter [org.apache.camel.impl.converter.DefaultTypeConverter] : Adding fallback type converter as a known type converter to convert from: long to: java.lang.String [org.apache.camel.impl.DefaultCamelContext] : timer://foo?delay=10000&fixedRate=true&period=60000 converted to endpoint: Endpoint[timer://foo?delay=10000&fixedRate=true&period=60000] by component: org.apache.camel.component.timer.TimerComponent@148662 [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=endpoints,name="timer://foo\?delay=10000&fixedRate=true&period=60000" [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=processors,nodeid=multicast1,name="Multicast[[To[direct:yyyy], To[direct:zyyy]]]" [org.apache.camel.impl.DefaultCamelContext] : Starting routes [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=routes,name="route3" [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=consumers,name=TimerConsumer(0x1bde4) [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=routes,name="route1" [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=consumers,name=DirectConsumer(0x1687e7c) [org.apache.camel.component.direct.DirectConsumer] : Starting consumer: Consumer[direct://yyyy] [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=routes,name="route2" [org.apache.camel.management.DefaultInstrumentationAgent] : Registered MBean with objectname: org.apache.camel:context=COMPUTER57/camel-1,type=consumers,name=DirectConsumer(0x1f64158) [org.apache.camel.component.direct.DirectConsumer] : Starting consumer: Consumer[direct://zyyy] [org.apache.camel.impl.DefaultCamelContext] : Route 0: EventDrivenConsumerRoute[Endpoint[timer://foo?delay=10000&fixedRate=true&period=60000] -> UnitOfWork(Channel[Multicast[[Channel[sendTo(Endpoint[direct:yyyy])], Channel[sendTo(Endpoint[direct:zyyy])]]]])] [org.apache.camel.impl.DefaultCamelContext] : Route 1: EventDrivenConsumerRoute[Endpoint[direct://yyyy] -> UnitOfWork(Channel[test.VCSRRouteBuilder$1@18f5824])] [org.apache.camel.impl.DefaultCamelContext] : Route 2: EventDrivenConsumerRoute[Endpoint[direct://zyyy] -> UnitOfWork(Channel[test.VCSRRouteBuilder$2@102799c])] [org.apache.camel.impl.DefaultCamelContext] : Started routes [org.apache.camel.impl.DefaultCamelContext] : Apache Camel 2.0.0 (CamelContext:camel-1) started [org.apache.camel.component.direct.DirectProducer] : Starting producer: Producer[direct:yyyy] [org.apache.camel.impl.ProducerCache] : Adding to producer cache with key: Endpoint[direct:yyyy] for producer: Producer[direct:yyyy] [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:yyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.component.direct.DirectProducer] : Starting producer: Producer[direct:zyyy] [org.apache.camel.impl.ProducerCache] : Adding to producer cache with key: Endpoint[direct:zyyy] for producer: Producer[direct:zyyy] [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:zyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.processor.MulticastProcessor] : Done sequientel processing 2 exchanges [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:yyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:zyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.processor.MulticastProcessor] : Done sequientel processing 2 exchanges [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:yyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:zyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.processor.MulticastProcessor] : Done sequientel processing 2 exchanges [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:yyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.component.direct.DirectProducer] : No consumers available on endpoint: Endpoint[direct:zyyy] to process: Exchange[Message: [Body is null]] [org.apache.camel.processor.MulticastProcessor] : Done sequientel processing 2 exchanges
-
5. Re: Iterable endpoint not working
davsclaus Dec 14, 2009 4:53 AM (in response to unwired)The issue is that you create those endpoints by hand and do not let Camel create them for you. Then they are not registered in the camel context.
If you do that by hand then do not refer to them using the String uri but the objects themself
from("direct:yyyy")
Should be
from(xxxx[1])
Then you are using your hand crafted endpoints consistently.