Storm和Spring 4整合 [英] Storm and Spring 4 integration

查看:132
本文介绍了Storm和Spring 4整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个原型风暴应用程序,它读取STOMP流并将输出存储在HBase上。它的工作原理,但不是很灵活,我试图以与我们的其他应用程序更一致的方式设置它,但没有太多运气搞清楚当前使用Storm的方式。我们使用spring-jms类,但不是以标准spring方式使用它们,而是在运行时创建它们,并手动设置依赖项。

I have a prototype storm app that reads a STOMP stream and stores the output on HBase. It works, but is not very flexible and I'm trying to get it set up in a more consistent way with the rest of our apps, but not having much luck figuring out how the current way of working with Storm. We use spring-jms classes, but instead of using them in the standard spring way, they are being created at run time, and setting dependencies manually.

此项目:< a href =https://github.com/granthenke/storm-spring> https://github.com/granthenke/storm-spring 看起来很有希望,但几年之内没有被触及过由于暴风雨罐已被带入apache孵化器并重新包装,因此无法正常构建。

This project: https://github.com/granthenke/storm-spring looked promising, but it hasn't been touched in a couple years and doesn't build properly since the storm jars have been taken into apache incubator and repackaged.

是否有我遗漏的东西,或者我不值得我去将这些东西集成在一起?

Is there something I'm missing, or is it not worth my while to get these things integrated?

推荐答案

事实上,风暴春天似乎正是你要找的但它没有更新和有限制(例如,不能在螺栓/喷口上定义任务等)。也许你应该推出自己的集成?

In fact, storm-spring seems to be what you are looking for but it is not updated and have limitations (cannot define tasks on bolts / spouts for instance, etc). Maybe you should roll your own integration?

不要忘记你的目标:一个有很多工人的集群。当您在另一个工作器上使用storm api(例如,重新平衡)部署拓扑时,spring的行为如何?这是否意味着在Storm部署目标螺栓/喷口并定义执行程序之前,必须在启动时在工作者JVM上实现新的Spring上下文?

Don't forget your target: a cluster with many workers. How does spring behave when you will deploy your topology with storm api (rebalance for instance) on one more worker? Does it mean it has to instanciate a new Spring context on the worker JVM at startup before Storm deploys the targeted bolts / spouts and defines the executors?

如果您仅定义IMHO它应该在Spring配置中使用Storm组件(拓扑的启动配置然后风暴只管理对象)但是如果依靠Spring来管理其他组件(对于spring-jms来说似乎如此),那么拓扑重新平衡可能会变得混乱例如(每个工人单身/ jvm?还是整个拓扑?)。

IMHO if you define only Storm components in a Spring configuration it should work (startup configuration for the topology then storm only manages the objects) but if you rely on Spring to manage other components (it seems so with spring-jms), then it could become messy on topology rebalances for instance (singleton per worker / jvm? Or the whole topology?).

由你来决定是否值得这么麻烦,我对春天的关注配置是你很容易忘记风暴拓扑(它似乎是一个JVM,但可以更多)。我个人每个类加载器定义自己的单例(例如静态最终或者如果我需要延迟实例,则使用双重检查锁定),因为它不会隐藏(中高)复杂性。

It is up to you to decide if it is worth the trouble, my concern with a Spring configuration is that you easily forget the storm topology (it seems it is one JVM but can be many more). Personally I define my own singletons per class-loader (static final for instance or with double check locking if I need deferred instanciation), as it does not hide the (medium-high) complexity.

这篇关于Storm和Spring 4整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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