I have a route
String XYZ = "xyz";
from(URL_A)
.bean(PropertiesSetterBean.class)
.to("${property." + XYZ + "}")
where PropertiesSetterBean
is:
@Component
class PropertiesSetterBean {
public void copyProperties(@Headers Map<String, Object> headers, @ExchangeProperties Map<String, Object> properties) {
properties.put("xyz", "direct:test")
}
}
The error I get:
Failed to create route route1 at: >>> DynamicTo[${property.xyz}] <<< in route: Route(route1)[From[seda:inEvents?concurrentCon... because of Property with key [property.xyz] not found in properties from text: ${property.xyz}
It looks like bean
doesn't get executed.
I use camel:3.7.3, spring-boot:2.4.3, java:11
Steps I did:
I looked into a similar issue.
And still, I cannot triage the issue.
What am I doing wrong?
UPDATE 1
I added the processor:
.process(exchange -> {
System.out.println("This is my property: " + exchange.getProperty("xyz"));
})
It works. In the meantime, I still cannot retrieve this property with simple
DSL in Camel.
After several hours of search with no result, I bumped into an old post.
To access the property, I will need to use "${exchangeProperty." + XYZ + "}"
.
Note:
$simple
instead of $
.exchangeProperty