319.6. Java DSL
ThriftDataFormat インスタンスを作成して、Camel DataFormat のマーシャリングおよびアンマーシャリング API に渡すことができます。
ThriftDataFormat format = new ThriftDataFormat(new Work()); from("direct:in").marshal(format); from("direct:back").unmarshal(format).to("mock:reverse");
ThriftDataFormat format = new ThriftDataFormat(new Work());
from("direct:in").marshal(format);
from("direct:back").unmarshal(format).to("mock:reverse");
または、DSL thrift()を使用して、デフォルトのインスタンスまたはデフォルトのインスタンスクラス名をアンマーシャリングします。
// You don't need to specify the default instance for the thrift marshaling from("direct:marshal").marshal().thrift(); from("direct:unmarshalA").unmarshal() .thrift("org.apache.camel.dataformat.thrift.generated.Work") .to("mock:reverse"); from("direct:unmarshalB").unmarshal().thrift(new Work()).to("mock:reverse");
// You don't need to specify the default instance for the thrift marshaling
from("direct:marshal").marshal().thrift();
from("direct:unmarshalA").unmarshal()
.thrift("org.apache.camel.dataformat.thrift.generated.Work")
.to("mock:reverse");
from("direct:unmarshalB").unmarshal().thrift(new Work()).to("mock:reverse");