On 8/29/07, Nicky Sandhu <[EMAIL PROTECTED]> wrote: > > In my rookie attempt to create the JDBC component > (https://issues.apache.org/activemq/browse/CAMEL-128)
Great stuff BTW! Have applied your patch - keep up the great work! :)\ > I encountered the > following questions > 1. If the exchange out is send out the ResultSet (open cursor) then is there > support for a callback on the exchange to allow a lifecycle of end on the > exchange to allow one to close out the ResultSet. Instead I have created a > limit on the read size and copied the data into a list of hash maps. Not > very efficient and I don't like it much. Any suggestions ? We're just in the process of adding an onComplete / onFailure handlers to the exchange, so you can close things like result sets and the like. https://issues.apache.org/activemq/browse/CAMEL-123 Hopefully as soon as those are working we can use 'em > 2. I would like the component to poll the database. Is such a polling > consumer better accomplished by doing > from("timer:...").setBody(sqlStmt).to("jdbc:...").pipeline("direct:a") ? Yeah - that should work now (we changed the timer component to be more reusable). Another idea - in general - is to make the endpoint derive from DefaultPollingEndpoint which has the 'poll by default' for a Consumer; then you just implement a PollingConsumer for the endpoint. Though in this case we probably wanna configure the SQL in the DSL, so using the timer as above is maybe simplest. > 3. Lastly the conversion mechanism from result set to other types. Any > suggestions on whether using the type converter is appropriate here ? Yeah - am sure we could think of some useful conversions; maybe to Lists of Maps or something; or to XML? Maybe the cached JDBC result set stuff might be useful? Or there's SDO? I've not looked at JDBC 4 yet but IIRC there's some SQL <-> POJO mapping stuff in there too I think. -- James ------- http://macstrac.blogspot.com/
