如何自定义XML标记添加到Apache配置骆驼 [英] How to add custom XML tag to Apache Camel configuration

查看:116
本文介绍了如何自定义XML标记添加到Apache配置骆驼的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现这样的:

<from uri="direct:pewpew" />
<doMegaWork status="Busy" message="Don't push on me!">
<to uri="direct:next"/>

我依然没有找到在谷歌同样的问题(更别说解决方案)。也许有人知道如何做到这一点?

I still did not find the same problem (much less a solution) on Google. Maybe someone knows how to do this?

推荐答案

自定义标记和/或命名空间(还)没有用骆驼支持(也许它永远不会是?)。

Custom tags and/or namespaces are not (yet) supported by Camel (and perhaps it will never be?).

我看到以下不同的解决方案来封装可重复使用的加工步骤:

I see following different solutions to encapsulate reusable processing steps:


  • 写一个单独的可重复使用的路线。我想这是最简单的解决方案,这样做的标准方法。

  • 写处理器/绿豆/服务,它封装了整个处理。

  • 包括一个完整的上下文连接到您的路线使用骆驼背景组件。首先,添加一个骆驼上下文注册表:

  • Write a separate reusable route. I guess this is the simplest solution and the standard way to do it.
  • Write a processor/bean/service that encapsulates the whole processing.
  • Include a full context into your route using the Camel context component. First, you add a Camel context to the registry:

registry.bind("accounts", myAccountContext);

然后使用上下文路线:

Then you use the context in your route:

<from uri="accounts:invoice"/>


  • 描述这里编写一个组件。

    这篇关于如何自定义XML标记添加到Apache配置骆驼的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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