Advertisement
Guest User

Untitled

a guest
Jul 19th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="
  5. http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
  6. http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
  7.  
  8. <bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
  9. <property name="location" value="classpath:config.properties" />
  10. </bean>
  11.  
  12. <bean id="dataSourceMySQL" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
  13. <property name="url" value="jdbc:mysql://127.0.0.1/test_database" />
  14. <!-- This causes an error, as it tries to connect with
  15. `${mysqlUser}`@`localhost` without any evaluation -->
  16. <property name="user" value="${mysqlUser}" />
  17. <property name="password" value="${mysqlPassword}" />
  18. </bean>
  19.  
  20. <service interface="javax.sql.DataSource" ref="dataSourceMySQL">
  21. <service-properties>
  22. <entry key="osgi.jndi.service.name" value="jdbc/mysqlDatasource" />
  23. </service-properties>
  24. </service>
  25. <bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
  26. <property name="dataSource" ref="dataSourceMySQL" />
  27. </bean>
  28.  
  29. <camelContext xmlns="http://camel.apache.org/schema/blueprint">
  30. <route id="messageQuery">
  31. <from uri="sql:SELECT * FROM messages" />
  32. <log message="The user property is: {{mysqlUser}}, the query result is: ${body}" />
  33. </route>
  34. </camelContext>
  35.  
  36. </blueprint>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement