169.3. 使用 Java DSL
例如,以下命令使用名为 DataFormat of jaxb,它配置多个 Java 软件包名称来初始化 JAXBContext。
DataFormat jaxb = new JaxbDataFormat("com.acme.model"); from("activemq:My.Queue"). unmarshal(jaxb). to("mqseries:Another.Queue");
DataFormat jaxb = new JaxbDataFormat("com.acme.model");
from("activemq:My.Queue").
unmarshal(jaxb).
to("mqseries:Another.Queue");
如果您希望使用命名引用的数据格式,然后在 Registry 中定义,例如通过 Spring XML 文件。
from("activemq:My.Queue"). unmarshal("myJaxbDataType"). to("mqseries:Another.Queue");
from("activemq:My.Queue").
unmarshal("myJaxbDataType").
to("mqseries:Another.Queue");