Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,22 @@ public String toString() {
};
}

/**
* Returns an Expression for the route id
*/
public static Expression routeIdExpression() {
return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
return exchange.getFromRouteId();
}

@Override
public String toString() {
return "routeId";
}
};
}

public static Expression dateExpression(final String command, final String pattern) {
return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ private Expression createSimpleExpressionDirectly(String expression) {
return ExpressionBuilder.threadNameExpression();
} else if (ObjectHelper.equal(expression, "camelId")) {
return ExpressionBuilder.camelContextNameExpression();
} else if (ObjectHelper.equal(expression, "routeId")) {
return ExpressionBuilder.routeIdExpression();
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ public void testSimpleExpressions() throws Exception {
assertExpression("in.headers.foo", "abc");
assertExpression("header.foo", "abc");
assertExpression("headers.foo", "abc");
assertExpression("routeId", exchange.getFromRouteId());
exchange.setFromRouteId("myRouteId");
assertExpression("routeId", "myRouteId");
}

public void testTrimSimpleExpressions() throws Exception {
Expand Down