You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Ole Andreas Hegle <he...@businesscape.no> on 2007/10/05 19:00:50 UTC
Improvement proposal for seda-endpoint
Hi
I got a problem with a seda-endpoint when I should send more than 1000
messages at a time.
I suggest you create a property value for the maximum queue size (today
this is 1000)
public class SedaComponent extends DefaultComponent {
public BlockingQueue<Exchange> createQueue() {
return new LinkedBlockingQueue<Exchange>(1000);
}
You should also alter the process(Exchange) method in SedaEndpoint from
queue.add(exchange.copy());
to something like this.
public void process(Exchange exchange) {
try{
if(queue.offer(exchange.copy(), 180, TimeUnit.SECONDS))
;
else
System.out.println("Problem, did not find capasity
in queue within 3 minutes");
}catch(Exception e){
System.out.println("Error processing exchange "+
e.toString());
}
}
This would make it much more reliable.
Regards
Ole Andreas Hegle
Software developer at Businesscape AS
Re: Improvement proposal for seda-endpoint
Posted by James Strachan <ja...@gmail.com>.
Sorry for the delay getting to your mail!
On 05/10/2007, Ole Andreas Hegle <he...@businesscape.no> wrote:
> Hi
>
> I got a problem with a seda-endpoint when I should send more than 1000
> messages at a time.
>
> I suggest you create a property value for the maximum queue size (today
> this is 1000)
We should definitely make that configurable.
I've raised a JIRA...
https://issues.apache.org/activemq/browse/CAMEL-230
and just applied a patch so you can now jus use
to("seda:foo?size=2000") etc
(This should apply to both SEDA and VM)
> public class SedaComponent extends DefaultComponent {
> public BlockingQueue<Exchange> createQueue() {
> return new LinkedBlockingQueue<Exchange>(1000);
> }
>
>
> You should also alter the process(Exchange) method in SedaEndpoint from
>
> queue.add(exchange.copy());
>
> to something like this.
>
> public void process(Exchange exchange) {
> try{
> if(queue.offer(exchange.copy(), 180, TimeUnit.SECONDS))
> ;
> else
> System.out.println("Problem, did not find capasity
> in queue within 3 minutes");
> }catch(Exception e){
> System.out.println("Error processing exchange "+
> e.toString());
> }
> }
>
> This would make it much more reliable.
I just want to understand your requirements a little better. Is the
idea you want to fail if you can't send (rather than blocking for the
messages to be consumed)?
I guess we could add a non-blocking mode where a send fails if the
send couldn't be completed immediately? Another option is to use a
non-blocking queue?
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com