首页 \ 问答 \ 好好利用风暴?(Good use of storm?)

好好利用风暴?(Good use of storm?)

我一直在阅读关于风暴和玩风暴先锋的例子。

我认为我已经理解了这个概念,并且它适用于很多情况。 我有一个测试项目,我想要了解更多关于这个,但我想知道风暴是否真的适合这个。

我遇到的概念问题是'流'定义。 看起来风暴将作为订阅流并实时处理它的魅力起作用,但我没有真正的流,而是我想要处理的有限数据集。

我知道这里有一个hadoop,但我对Storm的实时功能以及Storm撰写的Nathan在谈话中提到的其他有趣点感兴趣。

所以我想知道,人们是否会写Spouts来调查非流式API,然后对结果进行比较以模拟流?

第二个重要的一点是,似乎风暴拓扑从未完成处理,直到中断,这再次不适用于我的情况。 我希望我的拓扑知道,一旦我有限的源数据列表完成,处理可以终止并且可以发出最终结果。

那么,这在风暴术语中是否有意义,还是我看错了东西? 如果是这样,那么您对这种实时并行计算需求有什么替代方案?

谢谢!


I've been reading about Storm and playing around with the examples from storm-starter.

I think I got the concept and it applies very well to many cases. I have a test project I want to do to learn more about this, but I'm wondering if Storm is really suited for this.

The conceptual problem I'm having is with the 'streaming' definition. It seems that Storms will work as a charm subscribing to a stream and processing it in real time, but I don't really have a stream, but rather a finite collection of data that I want to process.

I know there's hadoop for this, but I'm interested in the real time capabilities of Storm as well as other interesting points that Nathan, who wrote Storm, mentions in his talks.

So I was wondering, do people write Spouts that poll non streaming APIs and then diff the results maybe to emulate a stream?

The second important point is, it seems that Storm topologies never finish processing until interrupted, which again doesn't apply to my case. I would like my topology to know that once my finite list of source data is finished, the processing can terminate and a final result can be emitted.

So, does that all make sense in Storm terms or am I looking at the wrong thing? If so, what alternatives do you propose for this sort of real time parallel computing needs?

Thanks!


原文:https://stackoverflow.com/questions/9377600
更新时间:2021-12-04 10:12

最满意答案

您将以下变量传递给您的方法:

public static double compoundValueMethod(double savingAmount,
                                         double annualInterestRate,
                                         int NumberOfMonth)

请注意,但在方法中使用静态变量numberOfMonth而不是传递的NumberOfMonth参数(Java中的变量名称区分大小写)。 numberOfMonth默认初始化为0 ,因此不输入for循环,方法返回0。

您应该消除静态变量并仅使用局部变量。 如果你首先这样做,你会得到一个编译错误,这将使你更容易找到你的错误。


You are passing the following variables to your method :

public static double compoundValueMethod(double savingAmount,
                                         double annualInterestRate,
                                         int NumberOfMonth)

Note but use the static variable numberOfMonth in your method instead of the passed NumberOfMonth parameter (variable names in Java are case sensitive). numberOfMonth is initialized to 0 by default, so your for loop is not entered and the method returns 0.

You should eliminate the static variables and only use local variables. Had you done that in the first place, you'd get a compilation error which would make it much easier to find your bug.

相关问答

更多
  • 您将以下变量传递给您的方法: public static double compoundValueMethod(double savingAmount, double annualInterestRate, int NumberOfMonth) 请注意,但在方法中使用静态变量numberOfMonth而不是传递的NumberOfMonth参数( ...
  • 该标准禁止您使用右值的地址: https ://stackoverflow.com/a/28459180/2642059不符合标准的编译器可能会允许这种行为,但确实这不是跨平台的行为,也不是即使在编译器的更新之间,它也能保证成功,它可以更紧密地与C ++标准对齐。 既然你不是为特定的编译器编写程序,而是为C ++编写程序,那么在特定的编译器中找到一些工作不应该是你的目标。 在标准范围内寻找一种方法来完成这一点将是更可取的。 一个简单的选项可以做到这一点: 通过将其分配给一个临时值将其变为左值。 他们是免费的 ...
  • 如果您总是期望找到一个值,那么抛出异常,如果它丢失。 这个例外就意味着有一个问题。 如果值可能丢失或存在,并且两者都对应用程序逻辑有效,则返回null。 更重要的是:你在代码中做什么其他的地方? 一致性很重要。 If you are always expecting to find a value then throw the exception if it is missing. The exception would mean that there was a problem. If the value ...
  • 当您有递归调用时,您需要返回递归调用的值。 public boolean isLargest(Node tmp, Node parent){ if(tmp.value > parent.value){ parent = parent.right; return tmp.isLargest(tmp, parent); } else if(parent.value == tmp.value){ System.out.println("test"); return true; } ...
  • 使用该代码,你不会收到消息: public Tail getTail(long value1, String value2, int value3) { List l = --> (I get list via Hibernate.) if (l.size() == 1) { return (Tail) l.get(0); } else if (l.size()>1){ for (Tail t: l) ...
  • 您似乎将CDI Extensions与生产者混合在一起。 首先,如果你想拥有一个生产者,那么工厂方法应该返回一个NewsListView ,而不是泛型类型。 使用@Producer和限定符注释将与带注释的类型绑定。 因此,无需使用NewsListView注释@FXMLManaged 。 然后你将NewsListView注入bean的某个地方。 制作视图: public class FXMLManagedProducer { @Produces @FXMLManaged public News ...
  • 看起来你想要Func 。 Looks like you want Func.
  • 函数应该只返回一个值,如果它需要返回一个值。 编写一个不返回任何内容的函数绝对没有错。 回答你的另一个问题:不,没有解决方案,因为在异步方法执行之前, method函数本身就会返回。 你甚至会回来什么? 代码将在for循环中进行n次迭代,那么你怎么知道哪一个甚至返回? A function should only return a value if it needs to return a value. There is absolutely nothing wrong with writing a fun ...
  • 该行只是意味着这样写的方法默认会返回id : - init { ... } 要么 + array { ... } 与 - (id)init { ... } 此外,没有显式参数类型的方法将采用id对象。 - initWithObject:object { ... } 是相同的 - (id)initWithObject:(id)object { ... } That line simply means that a method written as such, would, by default, ...
  • 简短而过于简化的答案是它不会返回任何东西 。 代码在任何发生异常的地方都会“中断”,并且它会一直处于堆栈状态,直到出现异常。 即使您碰巧遇到异常,您尝试使用方法的返回值初始化的变量仍将保持调用方法之前的状态: var i = 5; try { i = MyMethodThatThrowsAnException(); } catch { // at this point, the i variable still equals 5. } 我应该提到,如果抛出异常,你真的不应该担心函数的返回 ...

相关文章

更多

最新问答

更多
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • 电脑高中毕业学习去哪里培训
  • 电脑系统专业就业状况如何啊?
  • IEnumerable linq表达式(IEnumerable linq expressions)
  • 如何在Spring测试中连接依赖关系(How to wire dependencies in Spring tests)
  • Solr可以在没有Lucene的情况下运行吗?(Can Solr run without Lucene?)
  • 如何保证Task在当前线程上同步运行?(How to guarantee that a Task runs synchronously on the current thread?)
  • 在保持每列的类的同时向数据框添加行(Adding row to data frame while maintaining the class of each column)
  • 的?(The ? marks in emacs/haskell and ghc mode)
  • 一个线程可以调用SuspendThread传递自己的线程ID吗?(Can a thread call SuspendThread passing its own thread ID?)
  • 延迟socket.io响应,并“警告 - websocket连接无效”(Delayed socket.io response, and “warn - websocket connection invalid”)
  • 悬停时的图像转换(Image transition on hover)
  • IIS 7.5仅显示homecontroller(IIS 7.5 only shows homecontroller)
  • 没有JavaScript的复选框“关闭”值(Checkbox 'off' value without JavaScript)
  • java分布式框架有哪些
  • Python:填写表单并点击按钮确认[关闭](Python: fill out a form and confirm with a button click [closed])
  • PHP将文件链接到根文件目录(PHP Linking Files to Root File Directory)
  • 我如何删除ListView中的项目?(How I can remove a item in my ListView?)
  • 您是否必须为TFS(云)中的每个BUG创建一个TASK以跟踪时间?(Do you have to create a TASK for every BUG in TFS (Cloud) to track time?)
  • typoscript TMENU ATagParams小写(typoscript TMENU ATagParams lowercase)
  • 武陟会计培训类的学校哪个好点?
  • 从链接中删除文本修饰(Remove text decoration from links)