Claus,
Thanks a lot for your reply. I'm educating myself about spring now and
hopefully I'll be able to report something tomorrow :)
Vadim.
Claus Ibsen wrote:
Hi Vadim
Welcome on the Camel ride ;)
Your use-case is quite interesting as many companies do have network
restrictions and people from different networks need sometimes access to logs
and etc. We have the same problem at my current client. Need to call on the
phone to get log files from the servers for supporting ;) Just because the
administration of the servers has been outsourced to a different company.
So you are use ActiveMQ in network B to read using SQL from a server in network A?
Camel does support reading plain JDBC using this component:
http://activemq.apache.org/camel/jdbc.html
And also from this SQL:
http://activemq.apache.org/camel/sql-component.html
However they both need some better documentation I can see ;)
Well the key is to get hold of a DataSource to the SQL database that the JDBC
driver uses. This can be setup in spring xml files as you write that you use.
I want to point you in direction of a new unit test that was added to the
source code that demonstrates using Spring JDBC to write into a database, where
the SQL is in the java code. Nice and easy and just plain Java and Spring.
Later you can change it to the JDBC component if you like.
TransactionalClientDataSourceTest (just obmit the policy stuff in spring xml as
it does the trick to do transactional stuff)
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTest.java
The JDBC is executed in the BookService that is a plain POJO that is referenced
from the route in the above test.
BookService is a plain java POJO that has a Spring JDBCTemplate to do the SQL
stuff. The JDBCTemplate needs a DataSource and this is configured in the spring
xml file:
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/transactionalClientDataSource.xml
<!-- datasource to the database -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:camel"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
Note: Just use the DriverManagerDataSource during the proof of the concept. You
can later change it to something better. The DriverManagerDataSource is a
simple non pooled datasource. Spring provides other datasource but then you
need to look into the spring documentation or ask again or use google.
Okay something for starters, please let us know how it goes and ask again.
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Vadim Chekan [mailto:[EMAIL PROTECTED]
Sent: 2. juli 2008 05:36
To: [email protected]
Subject: MS SQL Message Service endpoint
Hi all,
Disclaimer: I'm new to ActiveMQ and I'm more familiar with .net then Java.
I'm working on a "pilot project" using ActiveMQ & Camel. I have people
who do not have access to network (lets call it network A) but they need
to see log files there. So I decided that it would be a nice project to
test ActiveMQ.
Given:
Two networks, A (restricted) and B (local).
Application server in A uses log4net. I have MS SQL server in network A
also.
User is in network B.
My solution.
Using Service Broker in MS SQL I created a queue and using AdoDotNet
provider in log4net I dump log messages into the sql queue.
ActiveMQ server in network B should read SQL Servr queue using jdbc
connector and publish is via xmpp.
The problem
I'm having problems with grasping configuaration conception. Beans,
spring, spring namespaces, my head is spinning. I understand that I need
camelContext tag, and routing from, to. But what is the format of "from"
uri? According to the documentation it is "jdbc:testdb?readSize=100".
What about server name? Driver name?
Is it possible to implement inconfiguration file, without writing and
deploying java class?
Thanks,
Vadim Chekan.