camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: IBatis component inconsistency
Date Thu, 16 Apr 2009 04:02:06 GMT
On Wed, Apr 15, 2009 at 7:24 PM, javadevel <javadevelva@yahoo.com> wrote:
>
> Clause,
>
> The fact that iBatis was sending an empty List (java.util.ArrayList) that
> could be confused as a legitimate response by the camel router was pretty
> obvious from the logs, I just thought that the camel iBatis component would
> know about this and check to see weather the List is empty or not before
> passing the message to the next hop.
>
> This is what I doing now
>
> from(“ibatis:selectunprocessedtrades”)
> .filter().method("traderoutehelper", "hasItems")//helper bean to check the
> list is empty or not
> .process(processtrades)
> .to(“ibatis:updateTrade”);
>
> Thanks again for all your help and quick response and let me know if you see
> anything wrong with the above solution.
You solution is perfect.

I have created a ticket in JIRA to allow a new option to the iBatis component
https://issues.apache.org/activemq/browse/CAMEL-1534

For some an empty result is also an answer so we need to support both cases.
And maybe the default could be to not route empty results :)


>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Its not that unclear iBatis is for interacting with a database and in
>> your from it will execute a SELECT
>> query and return the response from the database, regardless if there
>> are 0 or N number of rows.
>>
>> So a response with 0 rows is just as legal as a response with N rows,
>> i.e. the query as executed successful.
>>
>> If you do not want to process it further you can use the Filter EIP to
>> filter out responses with 0 rows.
>> http://camel.apache.org/message-filter.html
>>
>> However we could add some new option to the iBatis component to allow
>> it to cater for this so it wont route
>> if there are 0 rows returned in a SELECT query. Please feel free to
>> add a JIRA ticket for this
>> http://camel.apache.org/support.html
>> ( there is a link to issue tracker )
>>
>>
>> On Tue, Apr 14, 2009 at 8:30 PM, javadevel <javadevelva@yahoo.com> wrote:
>>>
>>> Here is my route
>>>
>>> from(“ibatis:selectunprocessedtrades”)
>>> .process(processtrades)
>>> .to(“ibatis:updateTrade”);
>>>
>>> What I would expect is that the camel route will be executed when the
>>> selectunprocessedtrades fetches rows of unprocessed trades, however, the
>>> route gets executed regardless of the result. This behavior, in my
>>> observation, is inconsistent with the rest of camel components. For
>>> example
>>> if we are polling a file
>>> from(“file:c:/work/”).to(“jms:processqueue)
>>> the route will only be executed when there is a file in the c:/work
>>> directory.
>>>
>>> Please advise.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/IBatis-component-inconsistency-tp23045297p23045297.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> Apache Camel Reference Card:
>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>
>>
>
> --
> View this message in context: http://www.nabble.com/IBatis-component-inconsistency-tp23045297p23063410.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration

Mime
View raw message