camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: onCompletion not triggerd in testing
Date Mon, 18 Nov 2013 12:31:22 GMT
receiveNoWait does not guarantee a message will be received.

You would need to use the one with a timeout value, to have client
poll server for new messages.

On Mon, Nov 18, 2013 at 12:23 PM, cristisor <cristisor_ac@yahoo.com> wrote:
> I found out the problem which was making my test not reach the onComplete
> syncProcessor but I am having another issue now. Inside the processor I use
> producer.sendBody(buildDurableSubscription(register), holder);, where
> producer is created in the context.xml with <camel:template id="producer" />
> and
> return consumer.receiveBodyNoWait(buildDurableSubscription(register),
> SettlementHolder.class);, where the consumer is created with
> <camel:consumerTemplate id="consumer"/>
>
> to put an exchange on a persistent queue, so that in case of power failure
> or any other reason I can have the exchange after a restart, and then to
> receive it back and process it after onCompletion. The problem is that
> sometimes the first time when the "consumer.receiveBodyNoWait" is invoked it
> returns null, but if I invoke it twice the second invocation will return the
> pending exchange. This is the logging:
> first invocation returns null:
> 12:56:54.628 [Camel (camelContextTransactionToDBPublisher) thread #2 -
> OnCompletion] DEBUG org.apache.camel.impl.ConsumerCache - <<<<
> Endpoint[activemq://queue:masterDataExport.transactionToDBPublisher.synchronizedSettlement.register1]
> 12:56:54.631 [Camel (camelContextTransactionToDBPublisher) thread #2 -
> OnCompletion] DEBUG o.a.activemq.ActiveMQMessageConsumer - remove:
> ID:pc-clucutar-63598-1384772199184-2:1:1:3, *lastDeliveredSequenceId:0*
>
> second invocation returns the object:
> 12:57:05.134 [Camel (camelContextTransactionToDBPublisher) thread #2 -
> OnCompletion] DEBUG org.apache.camel.impl.ConsumerCache - <<<<
> Endpoint[activemq://queue:masterDataExport.transactionToDBPublisher.synchronizedSettlement.register1]
> 12:57:05.138 [Camel (camelContextTransactionToDBPublisher) thread #2 -
> OnCompletion] DEBUG o.a.activemq.ActiveMQMessageConsumer - remove:
> ID:pc-clucutar-63598-1384772199184-2:1:1:4, *lastDeliveredSequenceId:55*
>
> Even though I can see that the queueSize = 1 in JConsole, the retrieve
> operation doesn't retrieve anything and the queueSize doesn't change. The
> second call retrieves the exchange and queueSize becomes 0.
>
> Any idea?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/onCompletion-not-triggerd-in-testing-tp5743163p5743434.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message