169.3. 使用 Java DSL
例如,以下命令使用名为 DataFormat 的 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");