346.3. 内容类型格式
可以解析 JSON 消息,将其转换为 Thrift 格式,并使用原生 util converter 重新解析。要使用这个选项,请将 contentTypeFormat 值设置为 'json',或使用第二个参数调用 thrift。如果没有指定默认实例,请始终使用原生二进制 Thrift 格式。简单 JSON 格式是只写的(marshal),它生成适合通过脚本语言解析的简单输出格式。示例代码显示如下:
from("direct:marshal") .unmarshal() .thrift("org.apache.camel.dataformat.thrift.generated.Work", "json") .to("mock:reverse");