[jboss-jira] [JBoss JIRA] Commented: (JBAS-7270) MDB Transaction Batch Support

Bob McWhirter (JIRA) jira-events at lists.jboss.org
Thu Sep 17 11:37:49 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBAS-7270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12486305#action_12486305 ] 

Bob McWhirter commented on JBAS-7270:
-------------------------------------

I'd probably add some default-commit-idle-timeout (optional?) which would commit any uncommitted batch if the batch sat idle for more than X milliseconds.

Assume you have a batch of 1000, and you just received a big stream of 999,999 messages, processed in 999 batches.

There's 1 last batch with 999 things sitting in it, waiting to be committed.  And for some odd edge-case reason, no more messages arrive for minutes/hours. So, these last 999 sit there, un-committed, waiting for that 1000th message to tip it over.

A watchdog ensuring that if the MDB sits idle for $TIMEOUT milliseconds, it'll get committed, regardless of batch-size or number-of-items-processed.

Edge-cases are fun!

> MDB Transaction Batch Support
> -----------------------------
>
>                 Key: JBAS-7270
>                 URL: https://jira.jboss.org/jira/browse/JBAS-7270
>             Project: JBoss Application Server
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: EJB3
>            Reporter: Clebert Suconic
>            Assignee: Carlo de Wolf
>
> When someone is receiving messages, this is a pretty common useCase:
> Consumer cons = sess.createConsumer(....);
> Transaction tx = getTheTransactionSomehow);
> int counter = 0;
> Message msg = null;
> try
>  {
>  do
>  {
>     msg = cons.receive(2000); // or a configured timeout
>     if (counter ++ == 1000) tx.commit();
>     performDBOperations(msg);
>  }
>  while (msg != null);
> }
> catch (Exception e)
> {
>    tx.rollback();
> }
> However, this is not possible over MDBs.  You basically have to transact every received message.
> With the code above, we would instead commit or rollback the entire group.
> It should be possible to do this kind of batching with MDBs somehow.
> IMO this should be suggested as part of the Specification, as other systems also have it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list