Apache camel 如何将exchange标头设置为路由的结果?
我有一个驼峰路线,它有一个调用子例程的步骤,将正文的文本部分转换为PDF。不幸的是,Apache camel 如何将exchange标头设置为路由的结果?,apache-camel,Apache Camel,我有一个驼峰路线,它有一个调用子例程的步骤,将正文的文本部分转换为PDF。不幸的是,camel pdf没有保留标题。有没有一种方法可以在不丢失当前交换的情况下获取子例程的值 子路线 from("seda:generate-pdf") // Back up the original in a header .setHeader("original", body()) // Create the PDF .to("pdf:create?textProcessingFactory=autoForm
camel pdf
没有保留标题。有没有一种方法可以在不丢失当前交换的情况下获取子例程的值
子路线
from("seda:generate-pdf")
// Back up the original in a header
.setHeader("original", body())
// Create the PDF
.to("pdf:create?textProcessingFactory=autoFormatting")
// UHOH! All my headers are gone :(
// Set the PDF as the header for the doc server
.setHeader("pdf", body())
// Move the indicator back to the body
.setBody(header("original")) // <-- this no longer exists
// Snip
// Unmarshal into Java
.unmarshal().json(JsonLibrary.Gson, MyReportContainingText.class)
// Call sub-route to generate the PDF
.inOut("seda:generate-pdf")
// UHOH! All my headers are gone :(
// Snip
当您从一个路由传递到另一个路由时,可以删除头中的内容,而不是将其保存为exchange属性。例如:
.setProperty("pdf", body())
.setProperty("pdf", simple("${body}")
只要Exchange存在,Exchange属性就存在。不要将内容保存在标头中,当您从一条路由传递到另一条路由时,可以将这些内容删除。请将其另存为Exchange属性。例如:
.setProperty("pdf", body())
.setProperty("pdf", simple("${body}")
只要Exchange存在,Exchange属性就存在。对于me@gstackoverflow,你需要解释更多。我知道你已经发现我的帖子对你没有帮助了me@gstackoverflow,你需要解释更多。我看你已经找到我的帖子了