camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aida <ai.d...@gmail.com>
Subject [ConsumerTemplate] Concurrency problems in Camel 2.11.2 (attached test)
Date Fri, 27 Sep 2013 13:43:55 GMT
Hi,

I have upgraded to Camel 2.11.2 . I'm trying to use the consumerTemplate for
read files in parallel but I have two kind of errors:

- Files that are not read (the receive method returns null when the file
exists)
- The content of the files is mixed (If I have the file "1.txt" with content
"1111" and "2.txt" with content "2222" the consumerTemplate gives me the
"2.txt" with content "11111")


I have written a test class that tests this (sometimes fails because of the
first error and others because of the second).

I attach it in case it can be of any help. The test works if I use the
consumerTemplate synchronizing the method that uses it, but it doesn´t when
I remove it.

What the test does:

	- Write a specified number of files (by default 5) in the target dir. All
files are different with different content. The file "N.txt" has
"NNNNNNNN......" as content
	- Start a route that reads in parallel (using a bean that uses the
consumerTemplate) all these files (one by one, in parallel)
	- The test retrieves the read exchanges and makes assertions to check that
all files have been read and that these files have the right content.
	
All what is needed is in the same class (to execute it the package
declaration must be updated for the appropiate one).


I supposed that in Camel 2.11.2, as the consumerTemplate is threadSafe I
could do this (read different files in parallel). Maybe It's not possible
...


Thanks in advance.

  Aida.

The test class is this:  ConsumerTemplateUsageTest.java
<http://camel.465427.n5.nabble.com/file/n5740295/ConsumerTemplateUsageTest.java>  



--
View this message in context: http://camel.465427.n5.nabble.com/ConsumerTemplate-Concurrency-problems-in-Camel-2-11-2-attached-test-tp5740295.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message