{"id":186208,"date":"2013-07-10T18:59:02","date_gmt":"2013-07-10T14:59:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=186208"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=186208","title":{"rendered":"<span class=\"post_title\">\u0418\u0437\u0443\u0447\u0430\u0435\u043c Storm Framework. \u0427\u0430\u0441\u0442\u044c I<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 2011 \u0433\u043e\u0434\u0443 Twitter \u043e\u0442\u043a\u0440\u044b\u043b, \u043f\u043e\u0434 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 <a href=\"http:\/\/www.eclipse.org\/legal\/epl-v10.html\">Eclipse Public License<\/a>, \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 <a href=\"http:\/\/storm-project.net\/\">Storm<\/a>. Storm \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 BackType \u0438 \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043a Twitter \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439.<\/p>\n<p>  Storm \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f <a href=\"http:\/\/hadoop.apache.org\/\">Apache Hadoop<\/a>, \u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>  \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Storm:  <\/p>\n<ul>\n<li><b>\u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c<\/b>. \u0417\u0430\u0434\u0430\u0447\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0443\u0437\u043b\u0430\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435.<\/li>\n<li><b>\u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u043e\u0442\u0435\u0440\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/b><\/li>\n<li><b>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f.<\/b><\/li>\n<li><b>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0435\u0432.<\/b> \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0438\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438.<\/li>\n<li><b>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Java.<\/b> \u041f\u0440\u043e\u0441\u0442\u043e\u0439 <a href=\"https:\/\/github.com\/nathanmarz\/storm\/wiki\/Multilang-protocol\">Multilang protocol<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c JSON \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b \u0434\u043b\u044f \u044f\u0437\u044b\u043a\u043e\u0432 Python, Ruby \u0438 Fancy.<\/li>\n<\/ul>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Storm \u0432\u0435\u0440\u0441\u0438\u0438 0.8.2.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b Storm<\/h2>\n<p>  <b>Tuple<\/b><br \/>  \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c Long, Integer, Short, Byte, String, Double, Float, Boolean \u0438 byte[] \u043f\u043e\u043b\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 Tuple \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u043c\u0438.<\/p>\n<p>  <b>Stream<\/b><br \/>  \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437 Tuple. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0445\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0432 Tuple.<\/p>\n<p>  <b>Spout<\/b><br \/>  \u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f Stream. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0438\u0437 \u043d\u0438\u0445 Tuple \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 Stream. \u041c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c Tuple \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 Stream. \u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438: <a href=\"https:\/\/github.com\/Xorlev\/storm-amqp-spout\">RabbitMQ \/ AMQP<\/a>, <a href=\"https:\/\/github.com\/nathanmarz\/storm-kestrel\">Kestrel<\/a>, <a href=\"https:\/\/github.com\/ptgoetz\/storm-jms\">JMS<\/a>, <a href=\"https:\/\/github.com\/nathanmarz\/storm-contrib\/tree\/master\/storm-kafka\">Kafka<\/a>.<\/p>\n<p>  <b>Bolt<\/b><br \/>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 Tuple. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 0 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 Tuple.<\/p>\n<p>  <b>Topology<\/b><br \/>  \u0421\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u0438. \u0410\u043d\u0430\u043b\u043e\u0433 MapReduce job \u0432 Hadoop. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 MapReduce job \u2014 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 Tuple \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 Spout \u0438 Bolt. \u041c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0438\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0432 Storm \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<h2>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430<\/h4>\n<p>  \u0415\u0441\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/data\/Cdr.java\">Cdr<\/a>. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 source \u043d\u043e\u043c\u0435\u0440\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f id \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 destination \u043d\u043e\u043c\u0435\u0440\u0430 \u0438 id \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u0440\u0438\u0444 \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u0432\u043e\u043d\u043a\u0430. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0430\u043f\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/BasicApp.java\">BasicApp<\/a>.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e Topology:  <\/p>\n<pre><code class=\"java\">TopologyBuilder builder = new TopologyBuilder(); <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Spout <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/storm\/CdrSpout.java\">CdrSpout<\/a> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:  <\/p>\n<pre><code class=\"java\">builder.setSpout(&quot;CdrReader&quot;, new CdrSpout()); <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Bolt \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438  \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a CdrReader. shuffleGrouping \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 CdrReader \u043f\u043e\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 Bolt.  <\/p>\n<pre><code class=\"java\">builder.setBolt(&quot;PrintOutBolt&quot;, new PrintOutBolt(), 2).shuffleGrouping(&quot;CdrReader&quot;); <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 Storm \u043a\u043b\u0430\u0441\u0442\u0435\u0440:  <\/p>\n<pre><code class=\"java\">Config config = new Config(); \/\/ \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e config.setDebug(false);  LocalCluster cluster = new LocalCluster(); \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 Storm \u043a\u043b\u0430\u0441\u0442\u0435\u0440 cluster.submitTopology(&quot;T1&quot;, config, builder.createTopology()); \/\/ \u0421\u0442\u0430\u0440\u0442\u0443\u0435\u043c Topology Thread.sleep(1000*10);  cluster.shutdown(); \/\/ \u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 <\/code><\/pre>\n<p>  \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> OUT&gt;&gt; [80]Cdr{callSource='78119990005', callDestination='8313610698077174239',  callTime=7631, clientId=0, price=0} OUT&gt;&gt; [78]Cdr{callSource='78119990006', callDestination='2238707710336895468',  callTime=20738, clientId=0, price=0} OUT&gt;&gt; [78]Cdr{callSource='78119990007', callDestination='579372726495390920',  callTime=31544, clientId=0, price=0} OUT&gt;&gt; [80]Cdr{callSource='78119990006', callDestination='2010724447342634423',  callTime=10268, clientId=0, price=0} <\/pre>\n<\/div>\n<\/div>\n<p>  \u0427\u0438\u0441\u043b\u043e \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u2014 Thread Id, \u0432\u0438\u0434\u043d\u043e \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438.<br \/>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434. \u041d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 Bolt&#8217;\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 Bolt \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0441\u0432\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 Storm \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 CustomStreamGrouping. <br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/storm\/CdrGrouper.java\">CdrGrouper<\/a>. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c Tuple \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 source \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 Bolt. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 CustomStreamGrouping \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0434\u0432\u0430 \u0432\u044b\u0437\u043e\u0432\u0430:<br \/>  <b>prepare<\/b> \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0432\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c:   <\/p>\n<pre><code class=\"java\">@Override     public void prepare(WorkerTopologyContext workerTopologyContext, GlobalStreamId globalStreamId, List&lt;Integer&gt; integers) {         tasks = new ArrayList&lt;&gt;(integers); \/\/ \u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440\u0430 Bolts     } <\/code><\/pre>\n<p>  \u0438 <b>chooseTasks<\/b> \u2014 \u0433\u0434\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 Tuple, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 Bolt&#8217;\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 Tuple:  <\/p>\n<pre><code class=\"java\">@Override     public List&lt;Integer&gt; chooseTasks(int i, List&lt;Object&gt; objects) {         List&lt;Integer&gt; rvalue = new ArrayList&lt;&gt;(objects.size());         for(Object o: objects) {             Cdr cdr = (Cdr) o;              rvalue.add(tasks.get(Math.abs(cdr.getCallSource().hashCode()) %                              tasks.size()));         }         return rvalue;     } <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u043d\u0438\u043c shuffleGrouping \u043d\u0430 CdrGrouper <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/BasicGroupApp.java\">BasicGroupApp<\/a>:  <\/p>\n<pre><code class=\"java\">builder.setBolt(&quot;PrintOutBolt&quot;, new PrintOutBolt(), 2).                 customGrouping(&quot;CdrReader&quot;, new CdrGrouper()); <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> OUT&gt;&gt; [80]Cdr{callSource='78119990007', callDestination='3314931472251135073',  callTime=17632, clientId=0, price=0} OUT&gt;&gt; [80]Cdr{callSource='78119990007', callDestination='4182885669941386786',  callTime=31533, clientId=0, price=0} <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c:<br \/>   <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/storm\/ClientIdBolt.java\">ClientIdBolt<\/a> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 id \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e source \u043d\u043e\u043c\u0435\u0440\u0443.<br \/>  <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/storm\/ClientIdGrouper.java\">ClientIdGrouper<\/a> \u2014 \u0413\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u0442 \u043f\u043e id \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<br \/>  <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/storm\/RaterBolt.java\">RaterBolt<\/a> \u2014 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439.<br \/>  <a href=\"https:\/\/github.com\/scanban\/stormex\/blob\/master\/src\/main\/java\/examples\/CalcApp.java\">CalcApp<\/a> \u2014 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0442\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430, \u0442\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u0445 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u043f\u043e\u0442\u0435\u0440\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435. \u041a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/scanban\/stormex\">GitHub<\/a>.<\/p>\n<p>  <b>PS.<\/b> \u0418\u0437 \u043f\u0435\u0441\u043d\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u043b\u043e\u0432\u0430 \u043d\u0435 \u0432\u044b\u043a\u0438\u043d\u0435\u0448\u044c, \u043d\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u00abBolt\u00bb \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u0443\u0449\u0430\u0435\u0442 \ud83d\ude42      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/186208\/\"> http:\/\/habrahabr.ru\/post\/186208\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 2011 \u0433\u043e\u0434\u0443 Twitter \u043e\u0442\u043a\u0440\u044b\u043b, \u043f\u043e\u0434 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 <a href=\"http:\/\/www.eclipse.org\/legal\/epl-v10.html\">Eclipse Public License<\/a>, \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 <a href=\"http:\/\/storm-project.net\/\">Storm<\/a>. Storm \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 BackType \u0438 \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043a Twitter \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439.<\/p>\n<p>  Storm \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f <a href=\"http:\/\/hadoop.apache.org\/\">Apache Hadoop<\/a>, \u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>  \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Storm:  <\/p>\n<ul>\n<li><b>\u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c<\/b>. \u0417\u0430\u0434\u0430\u0447\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0443\u0437\u043b\u0430\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435.<\/li>\n<li><b>\u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u043e\u0442\u0435\u0440\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/b><\/li>\n<li><b>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f.<\/b><\/li>\n<li><b>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0435\u0432.<\/b> \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0438\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438.<\/li>\n<li><b>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Java.<\/b> \u041f\u0440\u043e\u0441\u0442\u043e\u0439 <a href=\"https:\/\/github.com\/nathanmarz\/storm\/wiki\/Multilang-protocol\">Multilang protocol<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c JSON \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b \u0434\u043b\u044f \u044f\u0437\u044b\u043a\u043e\u0432 Python, Ruby \u0438 Fancy.<\/li>\n<\/ul>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Storm \u0432\u0435\u0440\u0441\u0438\u0438 0.8.2.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-186208","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/186208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=186208"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/186208\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=186208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=186208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=186208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}