Hi Vlad
Thanks for the investigations. Yes there could be an odd issue with the JDBC
component, as I would assume it could consume from the database = reading.
As a work around or how to get it working, you can get an endpoint in front to
kick it off.
from("timer://kickoff?delay=10000").setBody("select * from
xxxx").to("jdbc:msServiceBroker").to("activemq:aspcust1");
This is from a unit test in camel-jdbc. The timer fires every 10th second and
queries the database and send the result to the mock. In your case the activemq
instead.
from("timer://kickoff?period=10000").
setBody(constant("select * from customer")).
to("jdbc:testdb").
to("mock:result");
Notice that the result is a list of map objects, each row is a map with the
columnname as the key. From another unit test:
// assertions of the response
assertNotNull(out);
assertNotNull(out.getOut());
ArrayList<HashMap<String, Object>> data =
out.getOut().getBody(ArrayList.class);
assertNotNull("out body could not be converted to an ArrayList - was: "
+ out.getOut().getBody(), data);
assertEquals(2, data.size());
HashMap<String, Object> row = data.get(0);
assertEquals("cust1", row.get("ID"));
assertEquals("jstrachan", row.get("NAME"));
row = data.get(1);
assertEquals("cust2", row.get("ID"));
assertEquals("nsandhu", row.get("NAME"));
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: 3. juli 2008 01:33
To: [email protected]
Subject: Re: MS SQL Message Service endpoint
Ok, I got this one. My ActiveMQ installation does not contain camel-jdbc.jar.
It runs fine now but it gives me "Failed to execute main task. Reason:
java.lang.NoClassDefFoundError:
org/springframework/aop/support/AopUtils".
Copied spring-aop-2.5.1.jar
Ok, now:
Caused by: org.apache.camel.RuntimeCamelException: A JDBC Consumer would be the
server side of database! No such support here at
org.apache.camel.component.jdbc.JdbcEndpoint.createConsumer(JdbcEndpoint.java:56)
Hmm, I remember seeing this exception in the source code but I do not
understand it. why <from uri="jdbc:msServiceBroker" /> tries to create
a consumer. I thought that "from" is a message producer, right?
On Wed, Jul 2, 2008 at 12:33 PM, Vadim Chekan <[EMAIL PROTECTED]> wrote:
> Here is my progress:
> First of all it complained about DriverManagerDataSource class so I've
> downloaded spring-jdbc-2.5.1.jar and put it to lib/optional
> Now I'm getting
> =======================================
> Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be
> found
> for: jdbc:msServiceBroker
> at
> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelCo
> =======================================
>
> My configuration is:
> ===============================================================
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from uri="jdbc:msServiceBroker" />
> <to uri="activemq:aspcust1" />
> </route>
> </camelContext>
>
> <bean id="msServiceBroker"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> <property name="driverClassName"
> value="net.sourceforge.jtds.jdbc.Driver"/>
> <property name="url"
> value="jdbc:jtds:sqlserver://aspcust1/LogQueue;instance=main"/>
> <property name="username" value="****"/>
> <property name="password" value="****"/>
> </bean>
> ===============================================================
>
> I thought that it it the way this thing works: after jdbc uri you
> specify a bean, but apparently I got it wrong. I'm trying to define
> endpoint explicitly now withing camel context.
> Any help please?
>
> BTW: there is an error in schema location in default configuration
> file: http://activemq.apache.org/schema/core/activemq-core.xsd does
> not exist. I had to change it to
> http://activemq.apache.org/schema/core/activemq-core-5.1.0.xsd to make
> my Visual Studio hints working ;)
>
> --
> From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
> is explicitly specified
>
--
>From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified