346.7. Java DSL

ThriftDataFormat 인스턴스를 생성하고 Camel DataFormat marshal 및 unmarshal API로 전달할 수 있습니다.

   ThriftDataFormat format = new ThriftDataFormat(new Work());

   from("direct:in").marshal(format);
   from("direct:back").unmarshal(format).to("mock:reverse");

또는 다음과 같이 unmarshal 기본 인스턴스 또는 기본 인스턴스 클래스 이름을 전달하도록 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");