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

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

问题描述

我试图总结我的周围Apache的骆驼,这似乎是一个轻量级的ESB头。如果我理解正确的骆驼/ ESB产品,那么你可以把骆驼路线为节点和边缘的图形。每个节点是路线上的端点(可消耗/产生的消息)。每个边缘是两个不同的端点(1生产者和1消费者)之间的路线。

假设是正确的,我有一个现实的问题:什么最佳实践要求有关部署应用程序的ESB /骆驼路线?我应该打包它作为自己的JAR,还是值得为自身的耳部饱满的EJB,Web服务和其他JAR?

我想我询问如何骆驼路线或ESB应该部署/架构,如:

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

或者...

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


解决方案

从我的理解有几种方法可以运行骆驼。


  1. 在Java应用程序中嵌入:您可以在一个独立的Java应用程序中嵌入骆驼。在这种情况下,您将开始您的应用程序中的骆驼背景下,这将启动路线等等,这是伟大的,当你的应用需要的服务等进行沟通对于这个工作,你需要部署骆驼和第三方罐子组件类路径。


  2. 在Web应用程序嵌入式:随着人们早已指出,这似乎是一个受欢迎的选择。骆驼罐和第三方jar文件被包裹在一个WAR文件,基本上部署到Web容器如Tomcat举办骆驼的服务。


  3. 在应用服务器嵌入式:我已阅读如何骆驼部署到JBoss的作为一个应用服务器,比如一些文章,我甚至读到的人部署到Glassfish的。这似乎在如何部署到Tomcat非常相似。 JBoss的有一些,你将需要解决,这使得它棘手的类加载问题。所以,是的,你可以进入该WAR路线部署到应用服务器。


  4. 部署到OSGi的:你可以让你的骆驼相对较快罐子OSGi包,并部署到OSGi框架如Apache费利克斯。这是比较简单的jar转换为适当的OSGi包,然后部署。这里的一个大问题是,有些第三方可能没有兼容的OSGi包,为您部署。


我个人的preference是OSGi的路线。这是很容易,重量轻,可以让我有一个非常小的脚印主机我的骆驼路线为持续性服务(即窗口服务,Unix的守护进程)。

这是你应该现在意识到的事情是,Apache的骆驼可以通过多种方式进行部署,这是真的取决于你对你要如何做到这一点决定。我花了一段时间来理解如何,因为我曾与不同的部署模式发挥得不错的手感为它部署骆驼。我没碰过唯一一个被部署到应用服务器,因为我觉得大部分的服务器都够重。

至于架构而言,我喜欢让我不同的路线/应用程序在不同的罐子。由于我使用OSGi我希望能够更新特定路线和部署,而无需重新部署一切。如果在一个罐子部署的一切,你需要取下来的世界重建和重新部署的罐子。然而,这是个人的preference并可能会因人而异

希望这有助于一点。

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).

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?

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

Or...

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

解决方案

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

  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.

  2. 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.

  3. 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.

  4. 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.

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.

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.

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

Hope this helps a bit.

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

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