You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Daniel Gredler (Commented) (JIRA)" <ji...@apache.org> on 2011/11/18 05:21:52 UTC

[jira] [Commented] (CAMEL-4662) add batching support to sql component

    [ https://issues.apache.org/jira/browse/CAMEL-4662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13152633#comment-13152633 ] 

Daniel Gredler commented on CAMEL-4662:
---------------------------------------

Hi Christian,

Have you had a chance to look at the patch? Let me know if anything needs to be changed.

Take care,

Daniel
                
> add batching support to sql component
> -------------------------------------
>
>                 Key: CAMEL-4662
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4662
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-sql
>    Affects Versions: 2.8.2
>            Reporter: Daniel Gredler
>            Assignee: Christian Müller
>              Labels: patch
>         Attachments: camel-4662.patch
>
>
> When I first started using Camel, I expected something like this to automatically batch SQL update statements:
> from("direct:foo")
>     .aggregate(constant("all"), new StringCollector())
>     .completionSize(20) // batch size = 20
>     .completionTimeout(5000)
>     .to("sql:insert into foo values (#)?dataSourceRef=ds")
> I was surprised when this wasn't the case, because in general batching SQL update statements is much more efficient than executing them individually, and is best practice when there is a lot of data involved.
> The attached patch adds a "batch" attribute to the SQL component (default value is false), which should only be set to true for SQL update statements (insert, update, delete). If the "batch" attribute is true, then the interpretation of the inbound message body changes slightly -- instead of an Iterator of parameters, the component expects an Iterator that contains the parameter Iterators; the size of the outer Iterator determines the batch size.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira