在注册表中找不到数据格式 - Camel [英] Cannot find data format in registry - Camel
问题描述
我有一个maven项目,我正在尝试使用jaxb和camel使用以下命令封送文件:
I have a maven project, and I'm trying to marshal a file using jaxb and camel with the command:
from("file://...").marshal("myDataFormat").to("file://...");
当我运行项目时,我收到以下错误:
When I run the project, I get the following error:
Cannot find data format in registry with ref: myDataFormat
首先,有人知道注册表是什么吗?我搜索了谷歌,但找不到任何东西。我猜它可能是camel-context文件的另一个名字。其次,如何使用驼峰注册数据格式?我可以使用默认数据格式吗?
First, does anyone know what the "registry" is? I've searched Google, but can't find anything. I'm guessing it might be another name for the camel-context file. Second, how can I register a data format using camel? Is there a default data format that I can use?
很抱歉,如果答案很简单,但我对骆驼和我可以找到的在线文档相对较新太有用了。
Sorry if the answer is simple, but I'm relatively new to camel and the online docs that I can find haven't been too helpful.
推荐答案
你应该使用这样的东西
DataFormat jaxb = new JaxbDataFormat("com.acme.model");
from("activemq:My.Queue").
unmarshal(jaxb).
to("mqseries:Another.Queue");
换句话说,首先创建dataformat对象然后尝试解组它。
In other words, first create dataformat object then try to unmarshal it.
这篇关于在注册表中找不到数据格式 - Camel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!