ESB 应该如何打包/部署? [英] How should an ESB be packaged/deployed?

查看:24
本文介绍了ESB 应该如何打包/部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试围绕 Apache Camel,它似乎是一个轻量级的 ESB.如果我正确理解 Camel/ESB,那么您可以将 Camel Route 视为节点和边的图.每个节点都是路由上的一个端点(可以消费/生产消息).每条边都是两个不同端点(1 个生产者和 1 个消费者)之间的路由.

I am trying to wrap my head around Apache Camel, which appears to be a lightweight ESB. If I understand Camel/ESBs correctly, then you can think of a Camel Route as a graph of nodes and edges. Each node is an endpoint on the route (can consume/produce messages). Each edge is a route between two different endpoints (1 producer and 1 consumer).

假设这是正确的,我有一个实际问题:最佳实践对部署应用程序的 ESB/Camel Route 有何规定?我应该将其打包为自己的 JAR,还是值得成为自己的充满 EJB、Web 服务和其他 JAR 的 EAR?

Assuming that's correct, I have a practical question: what do best practices dictate about deploying your application's ESB/Camel Route? Should I package it up as its own JAR, or is it worthy of being its own EAR full of EJBs, Web Services and other JARs?

我想我在问应该如何部署/架构 Camel Route 或 ESB,例如:

I guess I'm asking how a Camel Route or ESB should be deployed/architected, like:

my-esb.ear/
    ejb1.jar/
        MyEJB_1.class
    ejb2.jar/
        MyEJB_2.class
    webservice.war/
        MyWebService.class

或者...

my-esb.jar/
    MyEJB_1.class
    MyEJB_2.class
    MyWebService.class

推荐答案

据我所知,您可以通过多种方式运行 Camel.

From my understanding there is a couple of ways you can run Camel.

  1. 嵌入在 Java 应用程序中:您可以将 Camel 嵌入到独立的 Java 应用程序中.在这种情况下,您将在您的应用程序中启动一个 Camel 上下文,它将启动路由等.当您的应用程序需要与服务等进行通信时,这非常有用.为此,您需要为组件部署 Camel 和第三方 jar类路径.

  1. Embedded in a Java Application: You can embed Camel in a stand alone Java application. In this scenario you would start a Camel Context inside your application which will start the routes etc. This is great when your application needs to communicate with services etc. For this to work you would need to deploy the Camel and third party jars for components to the classpath.

嵌入在 Web 应用程序中:正如人们已经指出的那样,这似乎是一种流行的选择.Camel jar 和第三方 jar 被包装在一个 WAR 文件中,并且基本上部署到一个 Web 容器(例如 Tomcat)来托管 Camel 服务.

Embedded in a Web Application: As people has already pointed out this seems the a popular option. The Camel jars and third party jars are wrapped in a WAR file and essentially deployed to a web container such as Tomcat to host the Camel services.

嵌入应用服务器:我已经阅读了一些关于如何将 Camel 部署到应用服务器(例如 JBoss)的文章,我什至还阅读了有关人们部署到 Glassfish 的文章.这与您部署到 Tomcat 的方式非常相似.JBoss 有一些您需要解决的类加载问题,这使得它变得棘手.所以是的,您可以通过 WAR 路线部署到应用程序服务器.

Embedded in a application server: I have read some article on how to deploy Camel to a Application server such as JBoss and I have even read about people deploying to Glassfish. This seems very similar in how you deploy to Tomcat. JBoss has some class loading issues that you would need to address which makes it tricky. So yes you can deploy to a application server by going the WAR route.

部署到 OSGi:您可以相对快速地将 Camel jar 设为 OSGi 包,然后部署到 OSGi 框架,例如 Apache Felix.将 jar 转换为合适的 OSGi 包然后进行部署相对简单.这里的一个大问题是某些第三方可能没有 OSGi 兼容包供您部署.

Deploy to OSGi: You can make your Camel jar a OSGi bundle relatively quickly and deploy to a OSGi framework such as Apache Felix. It is relatively simple to convert the jar to a proper OSGi bundle and then deploy. The one big problem here is that some third party might not have OSGi compatible bundles for you to deploy.

我个人的偏好是 OSGi 路线.它既简单又轻巧,让我可以将我的骆驼路线作为持久服务(即窗口服务、Unix Deamon)托管,占用空间很小.

My personal preference is the OSGi route. It is easy and lightweight and allows me to host my camel routes as persistent services (i.e. Window service, Unix Deamon) with a very small foot print.

您现在应该意识到的是,Apache Camel 可以通过多种方式进行部署,您可以决定如何部署.我花了一段时间才理解如何部署 Camel,因为我必须使用不同的部署模型才能对它有一个很好的感觉.我唯一没有接触的是部署到应用服务器,因为我觉得这些服务器中的大多数都足够重.

The thing that you should realise now is that Apache Camel can be deployed in several ways and it is really up to you to decide on how you want to do it. It took me a while to understand how to deploy Camel as I had to play with the different deployment models to get a good feel for it. The only one I have not touched was deploying to a Application Server as I felt most of these Servers are heavy enough.

就架构而言,我喜欢将不同的路由/应用程序保存在不同的 jar 中.由于我使用的是 OSGi,我希望能够更新特定路由并部署它,而无需重新部署所有内容.如果您将所有内容都部署在一个 jar 中,您将需要关闭世界重建并重新部署该 jar.但是,这是个人喜好,您的里程可能会有所不同

As far as architecture is concerned I like to keep my different routes/applications in different jars. Since I am using OSGi I like to be able to update a specific route and deploy it without having to redeploy everything. If you deployed everything in one jar you would need to take down the world rebuild and redeploy the jar. However this is personal preference and your mileage might vary

希望这会有所帮助.

这篇关于ESB 应该如何打包/部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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