camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jimmy Selgen Nielsen <jimmy.sel...@gmail.com>
Subject Re: Custom endpoint configuration and Spring Boot
Date Fri, 25 Sep 2015 09:56:49 GMT

> On 25. sep. 2015, at 11.42, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> 
> I would favor configuring this on the component and name it wmq, then
> the endpoints can be simply as you want.
> 
> So maybe something with
> 
> @Bean("wmq")
> JmsComponent myWmqComponent() {
> ...
> }
> 
> Not sure what the spring annotation is for assigning a name.
> 

Hmmm, not sure if i understand what you mean.

Here’s what i’m currently doing (simplified for clarity - might not compile)

@Bean
public CamelContextConfiguration contextConfiguration() {
	return new CamelContextConfiguration() {

		public void beforeApplicationStart(CamelContext camelContext) {
			IBMWebSphereMqDestinationResolver ibmWebSphereMqDestinationResolver = new IBMWebSphereMqDestinationResolver();

			ConnectionFactory connectionFactory = connectionFactoryMap().get("wmq");
			connectionFactory = setupJmsConnectionCaching(connectionFactory);
			connectionFactory = setupJmsLogging(connectionFactory);
			JmsComponent wmq = new JmsComponent(camelContext);
			wmq.setConnectionFactory(connectionFactory);
			wmq.setDestinationResolver(ibmWebSphereMqDestinationResolver);
			String componentName = "wmq;
			camelContext.addComponent(componentName, wmq);
		}
	};
}

This works well, but when starting the application, the routes get configured before the wmq
endpoint is enabled :
2015-09-25 10:20:39.845  INFO 10208 --- [           main] d.b.m.router.routes.MainframeRouter
  : Starting listener : INPUT_QUEUE
2015-09-25 10:20:40.057  INFO 10208 --- [           main] d.b.m.CamelConfig              
                : Registering component wmq

Now when i define a deadLetterQueue:
ErrorHandlerBuilder ehb = deadLetterChannel(backoutQueue).maximumRedeliveries(1);
from(String.format(“wmq:queue:%s", dest.getIn_queue_name()))….

I get this:
2015-09-25 11:52:41.085  INFO 12760 --- [           main] d.b.m.router.routes.MainframeRouter
  : Starting listener : INPUT_QUEUE
2015-09-25 11:52:41.101 ERROR 12760 --- [           main] o.s.boot.SpringApplication     
         : Application startup failed

java.lang.RuntimeException: org.apache.camel.ResolveEndpointFailedException: Failed to resolve
endpoint: wmq://queue:INPUT_QUEUE_BACKOUT due to: No component found with scheme: wmq
	at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:62)
	at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:33)

/J


Mime
View raw message