Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C9428834F for ; Mon, 5 Sep 2011 21:13:33 +0000 (UTC) Received: (qmail 15237 invoked by uid 500); 5 Sep 2011 21:13:33 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 14627 invoked by uid 500); 5 Sep 2011 21:13:32 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 14618 invoked by uid 99); 5 Sep 2011 21:13:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2011 21:13:31 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2011 21:13:30 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2BD3B59F40 for ; Mon, 5 Sep 2011 21:13:10 +0000 (UTC) Date: Mon, 5 Sep 2011 21:13:10 +0000 (UTC) From: "Mathieu Lalonde (JIRA)" To: dev@camel.apache.org Message-ID: <1234551985.18133.1315257190176.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (CAMEL-3142) JpaPollingConsumer - So you can more easily work with pollEnrich MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-3142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13097140#comment-13097140 ] Mathieu Lalonde edited comment on CAMEL-3142 at 9/5/11 9:12 PM: ---------------------------------------------------------------- *Status Update* (with less confusion this time) At the moment I have a JpaPollingConsumer that returns a list of polled entities. It supports all the PollingConsumer interface returning null when it couldn't poll anything. It supports maxMessagesPerPoll but maybe it shouldn't since it puts all the entities as a List in one message. Here is a snippet that shows how I implemented receive(timeout). Added delay (consumer.delay works as well) as an option with 500 ms as default. It is used as well by the ScheduledPolled JPA consumer. Let me know if you'd prefer a new option altogether for JpaPollingConsumer. {code} public Exchange receive(long timeout) { final StopWatch stopWatch = new StopWatch(); stopWatch.restart(); List polledEntities = doReceive(); while (polledEntities == null && stopWatch.taken() < timeout) { try { Thread.sleep(delay); polledEntities = doReceive(); } catch (InterruptedException e) { log.trace("received(long timeout) interrupted after {} ms: Are we stopping: {}", stopWatch.taken(), isStopping()); } } return createExchange(polledEntities); } {code} was (Author: mrlalonde): *Status Update* (with less confusion this time) At the moment I have a JpaPollingConsumer that returns a list of polled entities. It supports all the PollingConsumer interface returning null when it couldn't poll anything. It supports maxMessagesPerPoll. Here is a snippet that shows how I implemented receive(timeout). Should I add "pollInterval" as a configurable option? {code} public Exchange receive(long timeout) { final StopWatch stopWatch = new StopWatch(); stopWatch.restart(); List polledEntities = doReceive(); while (polledEntities == null && stopWatch.taken() < timeout) { try { Thread.sleep(pollInterval); polledEntities = doReceive(); } catch (InterruptedException e) { log.trace("received(long timeout) interrupted after {} ms: Are we stopping: {}", stopWatch.taken(), isStopping()); } } return createExchange(polledEntities); } {code} > JpaPollingConsumer - So you can more easily work with pollEnrich > ---------------------------------------------------------------- > > Key: CAMEL-3142 > URL: https://issues.apache.org/jira/browse/CAMEL-3142 > Project: Camel > Issue Type: New Feature > Components: camel-jpa > Affects Versions: 2.4.0 > Reporter: Claus Ibsen > Assignee: Mathieu Lalonde > Priority: Minor > Fix For: 2.9.0 > > Attachments: camel-jpa_initialPolish.patch > > > See > http://fusesource.com/forums/thread.jspa?threadID=2256&tstart=0 > The best solution is to add a JpaPollingConsumer implementation so it works better with pollEnrich -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira