camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nocturnal3d <nocturna...@gmail.com>
Subject Extending CamelContext namespace/schema
Date Fri, 04 Jul 2014 09:47:23 GMT
Hi guys,

I'm using Camel with blueprint, I need to kick off a liquibase script per
CamelContext for property access and this requires some bean instantiations
before the routes bootstrap (I need access to the context to be able to
discover the changelog file inside the context).

Currently I've extended the PropertiesResolver and added database access,
this works fine as I provide the accessor to the
PropertiesComponent/PropertyPlaceholder inside the blueprint.xml file and
processing of properties happens before the routes bootstrap - which is what
I need.

This is what the blueprint entries currently look like:

	...
	...
	<bean id="configDataSource"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
		<property name="driverClass" value="org.apache.derby.jdbc.EmbeddedDriver"
/>
		<property name="url"
value="jdbc:derby:target/embedded-configdb;create=true" />
		<property name="username" value="" />
		<property name="password" value="" />
	</bean>


	<bean id="propertiesResolver"
class="com.mycompany.support.camel.DatabasePropertiesResolver">
		<property name="dataSource" ref="configDataSource" />
		<property name="liquibaseConfigFile"
value="com/mycompany/support/camel/db.changelog-master.xml" />
	</bean>

	<camelContext id="testContext"
xmlns="http://camel.apache.org/schema/blueprint">
		<propertyPlaceholder
location="file:src/test/resources/com.mycompany.support.camel.cfg,db:schema:APP:table:SUPPORT"
			ignoreMissingLocation="false" propertiesResolverRef="propertiesResolver"
/>
		<routeBuilder ref="supportRoute" />
	</camelContext>
	...
	...


I would like to make this more 'developer friendly' by possibly extending
the camel namespace and use it like so:

	...
	...
	<bean id="configDataSource"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
		<property name="driverClass" value="org.apache.derby.jdbc.EmbeddedDriver"
/>
		<property name="url"
value="jdbc:derby:target/embedded-configdb;create=true" />
		<property name="username" value="" />
		<property name="password" value="" />
	</bean>

	<camelContext id="testContext"
xmlns="http://camel.apache.org/schema/blueprint">
		<myPropertyPlaceholder
location="file:src/test/resources/com.mycompany.support.camel.cfg,db:schema:APP:table:SUPPORT"
			dataSourceRef="configDataSource" 
			liquibaseFile="com/mycompany/support/camel/db.changelog-master.xml"
		/>
		<routeBuilder ref="supportRoute" />
	</camelContext>
	...
	...


Is this possible? Ultimately I need access the the camelContext BEFORE the
routes are realised. If there is a better, cleaner way I'm open for
suggestions.

thank you in advance, Jose.



--
View this message in context: http://camel.465427.n5.nabble.com/Extending-CamelContext-namespace-schema-tp5753333.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message