Hi, I want to send emails with an smtp endpoint. Source endpoint: message queue. Source message type: Person.class bean. I need to read the Person.email parameter somehow at the beginning of my route and save the value of the email bean parameter for the further processing. I want to use this value as a "to" parameter of my smtp endpoint.
I suppose that I can read the bean (which is on the body at the beginning of my route) via Simple like this: simple("${header.email}"). But if I rename the email member variable with my IDE (and getter/setter methods are renamed as well) then my code still correct syntactically because "email" is referenced as a string and my IDE wont rename this part of my code. Can I do something like this: setHeader("to", body().convertTo(Person.class).getEmail()) ? String emailEndpoint = "smtp://smtp.gmail.com:587?username=..&password=...&*to=%s*"; from(queueEndpointUrl) .log(LoggingLevel.DEBUG, LOGGER, "email sending...") .*setHeader("to", simple("${header.email}"))* .to("velocity:file:/....) .convertBodyTo(String.class) .log("Email is ready for send") .to( String.format(emailEndpoint, header("to")) .log("Email successfully sent"); -- View this message in context: http://camel.465427.n5.nabble.com/type-save-body-unboxing-tp5777342.html Sent from the Camel - Users mailing list archive at Nabble.com.