You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "John Yin (JIRA)" <ji...@apache.org> on 2014/01/07 17:55:55 UTC

[jira] [Commented] (CAMEL-7112) A single call of consumerTemplate.receiveBody consumes more than one messages from a SEDA queue

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

John Yin commented on CAMEL-7112:
---------------------------------

SInce it seems that I cannot attach files to this issue, here are the code to reproduce this issue:

public class TestProc implements Processor {
	
	public void process(Exchange exchange) throws Exception {
		SedaEndpoint queueEp = (SedaEndpoint) exchange.getContext().getEndpoint("seda:test");
		ConsumerTemplate cTemplate = (ConsumerTemplate) exchange.getContext().getRegistry().lookupByName("cTemplate");
		System.out.println("seda queue size before receive: " + queueEp.getExchanges().size());
		String msgBody = cTemplate.receiveBody(queueEp, 10, String.class);
		System.out.println("seda queue size after receive: " + queueEp.getExchanges().size());
	}

}

will produce the following output:

seda queue size before receive: 5 
seda queue size after receive: 0 

That is, after a single receive, the queue became empty.  The routes used are:

  <bean id="testProc" class="com.pci.TestSeda.TestProc" />
  <camel:camelContext xmlns="http://camel.apache.org/schema/spring">

        <camel:consumerTemplate id="cTemplate" />

    <camel:route>
      <camel:from uri="file:src/data?noop=true"/>
      <camel:to uri="seda:test" />
    </camel:route>
    
    <camel:route>
    <camel:from uri="timer://foo?period=500000" />
    <camel:process ref="testProc"/>
    </camel:route>
  </camel:camelContext>

Thank you!


> A single call of consumerTemplate.receiveBody consumes more than one messages from a SEDA queue
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-7112
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7112
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.12.2
>         Environment: JDK 1.7 on Windows 8.1
>            Reporter: John Yin
>
> When using consumer template's receiveBody on a SEDA queue that has multiple exchanges, a single call of receiveBody consumed more than one messages from the queue.  This happens for both receiveBody and receiveBodyNoWait.
> I will attach a test project that can produce this issue.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)