You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bhuvan Gupta <bh...@gmail.com> on 2016/01/22 09:55:30 UTC

seda blockWhenFull not acknowledged

Hello,

"BlockWhenFull" not acknowledged  i.e if size is set to 2 and i send 3 msg
in a loop with body as "1" , "2" and "3" than i get sleep msg for only "1"
and "2" and i guess third msg is silently dropped even when i have set the
"BlockWhenFull" as true.

*What am i doing wrong?*

version: 2.15.3

from("seda:myqueue?size=2&blockWhenFull=true").process(sleep());


private Processor sleep() {
                return new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
                        String body = exchange.getIn().getBody(String.class);
                        System.out.println(curTime() + " Going for
sleep sleepid=" + body );
                        Thread.sleep(5000l);
                        System.out.println(curTime() + " Done sleep
sleepid=" + body );
                    }
                };

for (Integer i = 0; i <5; i++) {
            Exchange exchange = new DefaultExchange(context);
            exchange.setPattern(ExchangePattern.InOnly);
            exchange.getIn().setHeader("header", i);
            exchange.getIn().setBody(i.toString());
           System.out.println("sending msg to seda");
           Exchange send = template.send("seda:myqueue",exchange);
           System.out.println("done:"+i);

        }

Re: seda blockWhenFull not acknowledged

Posted by Bhuvan Gupta <bh...@gmail.com>.
StackOver Link for the same question
http://stackoverflow.com/questions/34949651/apache-camel-seda-endpoint-blockwhenfull-not-acknowledged

On Fri, Jan 22, 2016 at 2:25 PM, Bhuvan Gupta <bh...@gmail.com> wrote:

> Hello,
>
> "BlockWhenFull" not acknowledged  i.e if size is set to 2 and i send 3 msg
> in a loop with body as "1" , "2" and "3" than i get sleep msg for only "1"
> and "2" and i guess third msg is silently dropped even when i have set the
> "BlockWhenFull" as true.
>
> *What am i doing wrong?*
>
> version: 2.15.3
>
> from("seda:myqueue?size=2&blockWhenFull=true").process(sleep());
>
>
> private Processor sleep() {
>                 return new Processor() {
>                     @Override
>                     public void process(Exchange exchange) throws Exception {
>                         String body = exchange.getIn().getBody(String.class);
>                         System.out.println(curTime() + " Going for sleep sleepid=" + body );
>                         Thread.sleep(5000l);
>                         System.out.println(curTime() + " Done sleep sleepid=" + body );
>                     }
>                 };
>
> for (Integer i = 0; i <5; i++) {
>             Exchange exchange = new DefaultExchange(context);
>             exchange.setPattern(ExchangePattern.InOnly);
>             exchange.getIn().setHeader("header", i);
>             exchange.getIn().setBody(i.toString());
>            System.out.println("sending msg to seda");
>            Exchange send = template.send("seda:myqueue",exchange);
>            System.out.println("done:"+i);
>
>         }
>
>

Re: seda blockWhenFull not acknowledged

Posted by Claus Ibsen <cl...@gmail.com>.
You need to set the blockWhenFull on the producer, eg where you send

 template.send("seda:myqueue?blockWhenFull",exchange);

On Fri, Jan 22, 2016 at 9:55 AM, Bhuvan Gupta <bh...@gmail.com> wrote:
> Hello,
>
> "BlockWhenFull" not acknowledged  i.e if size is set to 2 and i send 3 msg
> in a loop with body as "1" , "2" and "3" than i get sleep msg for only "1"
> and "2" and i guess third msg is silently dropped even when i have set the
> "BlockWhenFull" as true.
>
> *What am i doing wrong?*
>
> version: 2.15.3
>
> from("seda:myqueue?size=2&blockWhenFull=true").process(sleep());
>
>
> private Processor sleep() {
>                 return new Processor() {
>                     @Override
>                     public void process(Exchange exchange) throws Exception {
>                         String body = exchange.getIn().getBody(String.class);
>                         System.out.println(curTime() + " Going for
> sleep sleepid=" + body );
>                         Thread.sleep(5000l);
>                         System.out.println(curTime() + " Done sleep
> sleepid=" + body );
>                     }
>                 };
>
> for (Integer i = 0; i <5; i++) {
>             Exchange exchange = new DefaultExchange(context);
>             exchange.setPattern(ExchangePattern.InOnly);
>             exchange.getIn().setHeader("header", i);
>             exchange.getIn().setBody(i.toString());
>            System.out.println("sending msg to seda");
>            Exchange send = template.send("seda:myqueue",exchange);
>            System.out.println("done:"+i);
>
>         }



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2