在注册表中找不到数据格式 - Camel [英] Cannot find data format in registry - Camel

查看:30
本文介绍了在注册表中找不到数据格式 - 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

首先,有谁知道注册表"是什么?我已经搜索过谷歌,但找不到任何东西.我猜它可能是骆驼上下文文件的另一个名称.其次,如何使用骆驼注册数据格式?是否有我可以使用的默认数据格式?

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");

换句话说,首先创建数据格式对象,然后尝试对其进行解组.

In other words, first create dataformat object then try to unmarshal it.

这篇关于在注册表中找不到数据格式 - Camel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆