Claus

@Value was added in spring 3.1 - so this is a spring dm support issue?  Let
me see if camel is using the latest flavor of the month

Chris

On Mon, Nov 5, 2012 at 8:09 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:

> On Fri, Nov 2, 2012 at 10:17 PM, Christopher Love
> <ch...@cnmconsulting.net> wrote:
> > Claus and other
> >
> > I am just coming up to speed on blueprint / osgi, and I think I may be
> > running into the same form of issue.  @Value with property place holder
> > does not seem to be populating when the route is deployed inside of
> Karaf.
> >  In unit test it populates the string correctly running inside of Karaf
> it
> > does not.
> >
>
> I assume @Value is from Spring Framework? And when was this added to
> Spring? Anyone knows?
> Maybe Spring-DM 1.2.1 don't support it
>
>
> > Here is some pertinent code:
> >
> > @Component
> > public class EdiTmpClaimRoute extends SpringRouteBuilder {
> >
> > private @Value("${file.path}")
> > String filePath;
> >
> > @Override
> > public void configure() throws Exception {
> >
> from("activemq:claim-queue?concurrentConsumers=50&asyncConsumer=true")
> >     .routeId("edi-qsi-tmp-file-route")
> >
> >
> .to("file:"+filePath+"/?fileName=${date:now:yyyyMMdd}-qsi-${exchangeId}.txt");
> > }
> >
> > }
> >
> > @Configuration
> > @PropertySource("classpath:smilebrands-edi.properties")
> > @ComponentScan(basePackages = { "com.smilebrands.edi.camel",
> > "com.smilebrands.edi.core.qsi" })
> > public class CamelServerConfig implements InitializingBean,
> > BundleContextAware, ApplicationContextAware {
> >
> >   private BundleContext bundleContext;
> >
> >   public BundleContext getBundleContext() {
> >     return bundleContext;
> >   }
> >
> >   public void setBundleContext(BundleContext bundleContext) {
> >     this.bundleContext = bundleContext;
> >   }
> >
> >   private ApplicationContext applicationContext;
> >
> >   public void setApplicationContext(ApplicationContext ac) {
> >     this.applicationContext = ac;
> >   }
> >
> >   protected ApplicationContext getApplicationContext() {
> >     return this.applicationContext;
> >   }
> >
> >   @Bean
> >   public ActiveMQComponent amq(@Value("${broker.url}") String brokerURL)
> {
> >     ActiveMQComponent activeMQComponent = new ActiveMQComponent();
> >     activeMQComponent.setBrokerURL(brokerURL);
> >     return activeMQComponent;
> >   }
> >
> >   @Override
> >   public void afterPropertiesSet() throws Exception {
> >     // TODO Auto-generated method stub
> >
> >   }
> >
> >   @Bean
> >   public static PropertySourcesPlaceholderConfigurer
> > propertySourcesPlaceholderConfigurer() {
> >     return new PropertySourcesPlaceholderConfigurer();
> >   }
> >
> > }
> >
> > camel-context.xml
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans";
> >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xmlns:context="http://www.springframework.org/schema/context";
> >  xmlns:camel="http://camel.apache.org/schema/spring";
> > xsi:schemaLocation="
> >  http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >  http://www.springframework.org/schema/context
> > http://www.springframework.org/schema/context/spring-context.xsd
> >    http://camel.apache.org/schema/spring
> > http://camel.apache.org/schema/spring/camel-spring.xsd";
> >  >
> >
> >   <camelContext xmlns="http://camel.apache.org/schema/spring";>
> >     <contextScan/>
> >   </camelContext>
> >
> >   <bean class="com.smilebrands.edi.config.CamelServerConfig"/>
> >   <!-- be sure the configure class to be processed -->
> >   <context:annotation-config/>
> >
> > </beans>
> >
> > What are your recommendations?  You are stating to use blueprint, but
> does
> > blueprint have the same type of capabilities?
> >
> > Thanks
> >
> > Chris
> >
> > On Wed, Sep 5, 2012 at 7:42 AM, Claus Ibsen <claus.ib...@gmail.com>
> wrote:
> >
> >> Hi
> >>
> >> Using Aries Blueprint should work fine.
> >>
> >> There is possible a need for a Gemini integration with Camel to make
> >> this work out of the box.
> >>
> >> Fell free to help out, and take a look at camel-blueprint, which is
> >> the component that integrates with Aries Blueprint.
> >> Yeah that should maybe have been named camel-blueprint-aries, to leave
> >> room for camel-blueprint-gemini,
> >>
> >>
> >> On Tue, Sep 4, 2012 at 3:24 PM, ladoe00 <lado...@yahoo.com> wrote:
> >> > Hi,
> >> >
> >> >   I used to have a working system using Spring-OSGi, XML configs and
> >> Camel
> >> > 2.5 and I thought it would be great to upgrade to the latest version
> for
> >> all
> >> > those components.  So I am now using Gemini Blueprint (replacement for
> >> > Spring-OSGi), Spring Java config to get rid of XML and Camel 2.10.1.
>  I
> >> have
> >> > converted every XML file to be @Configuration classes with
> RouteBuilders,
> >> > which I think is great, but now I am having problems injecting a
> >> > CamelContext and ProducerTemplates.  That will just not work at all.
>  I
> >> must
> >> > be missing something...
> >> >
> >> > For example:
> >> > public class MyConfig extends SingleRouteCamelConfiguration implements
> >> > CamelContextAware
> >> > {
> >> >     @Value("input")
> >> >     private String input;
> >> >
> >> >     @Autowired
> >> >     private Factory myFactory;
> >> >
> >> >     @EndpointInject(uri="seda:aQueue")
> >> >     private ProducerTemplate producer1;
> >> >
> >> >     @Produce(uri="seda:aQueue")
> >> >     private ProducerTemplate producer2;
> >> >
> >> >     private CamelContext camelContext;  //  with appropriate
> >> getter/setter
> >> > ...
> >> > }
> >> >
> >> > input and myFactory are injected with values, but producer1, producer2
> >> and
> >> > camelContext are not.
> >> >
> >> > I am using Equinox and Eclipse Gemini Blueprint Extender, camel-core,
> >> > camel-spring, camel-spring-javaconfig as well as one XML support file
> >> (that
> >> > does get loaded):
> >> > <beans>
> >> >     <context:annotation-config/>
> >> >     <context:component-scan base-package="*"/>
> >> >     <context:property-placeholder
> >> location="classpath:config.properties"/>
> >> > </beans>
> >> >
> >> > I have no camelContext declared anywhere.  My routes are declared and
> >> > created with @Configuration classes returning RouteBuilders (this part
> >> works
> >> > well).
> >> >
> >> > In summary, everything works well beside Camel annotations (@Produce,
> >> > @EndpointInject and CamelContextAware interface, which should inject a
> >> > CamelContext from my understanding).  What am I not declaring/not
> >> starting
> >> > right?
> >> >
> >> > Thanks!
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >>
> http://camel.465427.n5.nabble.com/Issue-with-Camel-annotations-not-being-processed-OSGi-Blueprint-Javaconfig-tp5718606.html
> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cib...@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.com
> >> Author of Camel in Action: http://www.manning.com/ibsen
> >>
> >
> >
> >
> > --
> > Chris Love
> > cl...@cnmconsulting.net
> > (303) 929-8509
> > http://www.cnmconsulting.net
> > Calendar: http://j.mp/cnmCalendar
> > Follow me on twitter: @chrislovecnm
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cib...@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
Chris Love
cl...@cnmconsulting.net
(303) 929-8509
http://www.cnmconsulting.net
Calendar: http://j.mp/cnmCalendar
Follow me on twitter: @chrislovecnm

Reply via email to