camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <hekon...@gmail.com>
Subject Re: Custom endpoint configuration and Spring Boot
Date Fri, 25 Sep 2015 15:51:44 GMT
Hi Jimmy,

If you would like to provide different destination resolvers for different
environments, use Spring Boot conditionals. For example:

@ConditionalOnProperty(name = "env", matchIfMissing = true)
@Bean(name="wmq")
DestinationResolver devdestinationResolver() {...}

@ConditionalOnProperty(name = "env", havingValue = "production")
@Bean(name="wmq")
DestinationResolver prodDestinationResolver() {...}

@ConditionalOnProperty(name = "env", havingValue = "staging")
@Bean(name="wmq")
DestinationResolver stagingDestinationResolver() {...}

Cheers!

pt., 25.09.2015 o 15:08 użytkownik Jimmy Selgen Nielsen <
jimmy.selgen@gmail.com> napisał:

>
> > On 25. sep. 2015, at 14.18, Henryk Konsek <hekonsek@gmail.com> wrote:
> >
> > Hi Jimmy,
> >
> > If you would like to create a simple URI for the pre-configured
> component,
> > then Claus suggestion to create a Spring bean with name/alias matching
> your
> > target component, is a way to go. Register the pre-configured JMS
> component
> > via:
> >
> > @Bean(name = "wmq")
> > JmsComponent myWmqComponent() {
> >  JmsComponent  jmsComponent = new JmsComponent();
> >
> >  jmsComponent.setDestinationResolver(new MQDestinationResolver());
> >
> >  return jmsComponent;
> > }
> >
> >
> > Then use the "wmq" bean name in the endpoint URI:
> >
> >
> >  from("wmq:myQueue").to(…);
> >
>
> I was looking into this.
>
> I have multiple environments that i configure destination resolvers
> dynamically for, so it would have required manually registering them in the
> Spring context, which IIRC is a lot more work.
>
> I could use a BeanDefinitionRegistryPostProcessor, but since the
> destinationResolvers configuration is auto wired in, that wouldn’t work.
>
> I’ll keep looking at this when i have time, but for now the workaround
> actually works :)
>
> /J

-- 
Henryk Konsek
http://about.me/hekonsek

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message