camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mister blinky <>
Subject SSH return not working with isEqualTo
Date Fri, 24 Jan 2014 17:40:48 GMT
Hi I'm new to Camel. I'm using the SSH component to invoke a shell script on
a remote machine. The returned value is 0 for success and 1 for failure. I
want to branch conditionally in my route depending on which i get, but,
using isEqualTo, in, and startsWith, etc. isn't working. 

I'm sure it's something basic, so my first question is: what is the
canonical way to do this?

Here's how i'm doing it and testing it. Very simple route

from("ssh://user:pwd@host?pollCommand=" + command)
.log("$$$$$$ ${body}")
.when(body().isEqualTo("0")).log("@@@ IT IS 0")
.otherwise().log("@@@ NOT 0")

No matter what i do, the "otherwise" gets invoked. The logged body shows
that the contents are "0". I have tried of other approaches with no luck. I
understand that the message body is an Object, so maybe i need to cast it to
a String? If so, how to do that. I tried wrapping it in string() but that's
not legal. 

For testing, I replaced my when with 

.when(constant("0").isEqualTo("0")).log("@@@ IT IS 0")

and of course that worked.

Suggestions appreciated.....

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message