richard
richard

Reputation: 3299

Camel resequencer removing the initial time

I am using Camels resequencer in the 'stream' mode to insure that files are processed in the correct order

.resequence(new MySequencingExpression()).stream().timeout(60000))

The timeout has to be in the order of minutes as we have the occasionally get files that are completely out of order

When I run this up I have noticed that the processing on the first file will be delayed the timeout period - which is totally unacceptable for us.

Having examined the code the initial delay occurs because the code is essentially trying to compare the first file to its non existent predecessor and then timing out. What it should be doing is something like 'have I had a file in the last timeout period, then if so, was it the correct predecessor?'

Is there any workaround for this?

Thanks

Richard

Upvotes: 0

Views: 282

Answers (1)

Łukasz
Łukasz

Reputation: 41

This is not a bug, please refer to the ResequencerEngine documentation

If the last-delivered element is null i.e. the resequencer was newly created the first arriving element needs timeout milliseconds in any case for becoming ready-for-delivery.

Regarding your comment:

Give the sequence 1, 2, 3, 4 and given that 1 and 2 have arrived - at this point the code could start processing

What about if after 1 and 2 came 0?

I think it would be great if the developers allowed user to set the first expected value, because usually we know what it is and it would save unnecessary delay at resequencer startup, but I don't think its currently possible.

Upvotes: 1

Related Questions