You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "jason.parr" <ja...@usa.net> on 2011/10/04 10:57:07 UTC
Re: NotifyBuilder condition fails to match on an out/activemq
endpoint
I took a while to test this but the new wereSentTo condition matches too
eagerly, in your above example whenDone matches on any received message on
any endpoint and then the first wereSentTo match forces the whole predicate
to be true. What if you want is to wait for a number of messages just like
whenDone?
Need something like:
Eg:
public NotifyBuilder wereSentTo(final String endpointUri, *final int
number*) {
stack.push(new EventPredicateSupport() {
private int current;
@Override
public boolean onExchangeSent(Exchange exchange, Endpoint
endpoint, long timeTaken) {
if (EndpointHelper.matchEndpoint(endpoint.getEndpointUri(),
endpointUri)) {
// we should match if matching once
current++;
}
return false;
}
public boolean matches() {
return current >= number;
}
@Override
public void reset() {
matches = false;
}
@Override
public String toString() {
return "wereSentTo(" + endpointUri + ")";
}
});
return this;
}
Then can do as expected:
NotifyBuilder notify = new NotifyBuilder(context)
.wereSentTo("jms:queue:CAPTURED.MESSAGES", *5*);
Whilst the current camel 2.9 code with
NotifyBuilder notify = new NotifyBuilder(context)
.whenDone(5).wereSentTo("jms:queue:CAPTURED.MESSAGES");
Fires on first message reaching CAPTURED.MESSAGES not after the required 5.
Also noticed that variable expansion of urls doesnt seem to happen in the
NotifyBuilder.
--
View this message in context: http://camel.465427.n5.nabble.com/NotifyBuilder-condition-fails-to-match-on-an-out-activemq-endpoint-tp4689038p4867857.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: NotifyBuilder condition fails to match on an out/activemq
endpoint
Posted by "jason.parr" <ja...@usa.net>.
Raised: https://issues.apache.org/jira/browse/CAMEL-4551
--
View this message in context: http://camel.465427.n5.nabble.com/NotifyBuilder-condition-fails-to-match-on-an-out-activemq-endpoint-tp4689038p4909336.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: NotifyBuilder condition fails to match on an out/activemq endpoint
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah you may have a point. Can you create a JIRA ticket? Will look
into this when I get back to my office. I am traveling this week.
On Mon, Oct 10, 2011 at 11:02 AM, jason.parr <ja...@usa.net> wrote:
> Without any further changes the new wereSentTo added for 2.9 seems of very
> limited use as previously posted it fires too eagerly.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/NotifyBuilder-condition-fails-to-match-on-an-out-activemq-endpoint-tp4689038p4887499.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: NotifyBuilder condition fails to match on an out/activemq
endpoint
Posted by "jason.parr" <ja...@usa.net>.
Without any further changes the new wereSentTo added for 2.9 seems of very
limited use as previously posted it fires too eagerly.
--
View this message in context: http://camel.465427.n5.nabble.com/NotifyBuilder-condition-fails-to-match-on-an-out-activemq-endpoint-tp4689038p4887499.html
Sent from the Camel - Users mailing list archive at Nabble.com.