48.3. 使用 Java DSL
以下示例使用 jaxb 的命名 DataFormat,它配置有 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");