Camel 处理器与服务端点中的业务逻辑 [英] Business logic in Camel processors vs service endpoints

查看:35
本文介绍了Camel 处理器与服务端点中的业务逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Camel 路由中,我是否应该考虑将我的业务逻辑放在离散托管的 bean 端点中,例如消息驱动 bean 或 Web 服务,而不是仅在 Camel 处理器中实现它?

In a Camel route, should I be thinking about putting my business logic in a discretely hosted bean endpoint, like a message-driven bean or a web service, vs just implementing it in Camel processors?

将 Camel 仅用于调解和使用似乎更清晰地分离关注点编排,使用处理器作为过滤器,而不是作为业务逻辑的容器.但是,我认为此时不需要 EJB 容器,而且我似乎需要一个来托管 MDB.

It seems like cleaner separation of concerns to use Camel just for mediation & orchestration, using Processors as filters, rather than as a container for business logic. However I don't forsee the need for an EJB container at this time, and it seems like I'd need one to host MDBs.

更简洁的架构与更小的占地面积、更少的技术 - 有没有人对此有想法、观点或强烈的感受?

So cleaner architecture vs smaller footprint, fewer technologies - Does anyone have thoughts, perspectives, or strong feelings about this?

推荐答案

我一般使用 Camel 来执行以下...

I generally use Camel to perform the following...

  • 任何组件集成(文件、jms、http等)
  • 实现EIP 逻辑(基于内容的路由、过滤器、节流等).)
  • 基于计时器的进程(使用 计时器石英)
  • 异常处理(重试逻辑、错误记录/通知/排队)
  • any component integration (file, jms, http, etc)
  • to implement EIP logic (content based routing, filters, throttling, etc.)
  • timer based processes (using timer or quartz)
  • exception handling (retry logic, error logging/notification/queueing)

否则,对于自包含的业务逻辑(尤其是遗留集成),最好使用 POJO 或 WebServices.这提高了可测试性并使您的应用程序更加模块化等.然后,您可以将 Camel 用于以下...

Otherwise, for business logic that is self contained (especially legacy integration), it may be preferable to use POJOs or WebServices. This promotes testability and makes your application more modular, etc. Then, you can use Camel for the following...

关于长时间运行的进程,Camel 可以通过各种异步模式/技术(JMS、CXF、轮询消费者、计划作业等),并让您控制线程一个>...

In regards to long running processes, Camel can facilitate this via various asycnhronous patterns/technologies (JMS, CXF, polling consumers, scheduled jobs, etc.) as well as gives you control over threading...

话虽如此,切片的方法有很多种.Camel 轻巧、灵活,旨在简化与现有技术的集成,而不是取代它们......祝你好运

That all said, there are many ways to slice it. Camel is lightweight, flexible and designed to ease integration with existing technologies, not replace them...good luck

这篇关于Camel 处理器与服务端点中的业务逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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