lazyshot / storm-php Goto Github PK
View Code? Open in Web Editor NEWStorm Multilang support with PHP [INACTIVE]
Storm Multilang support with PHP [INACTIVE]
Could you consider adding a license to this project?
how we can run WordCountTopology with php ? can you explain more ?
Hi,
I'm running into an issue with my PHP bolts. I can successfully process an incoming stream, but the bolts usually fail because of a lack of acking.
I'm linking two php bolts sequentially, and they both look like the following:
values[0]; $this->emit(array($values*5)); $this->ack($tuple); } } $splitsentence = new ActivateGiftCardBolt(); $splitsentence->run(); ?>and the Java code for the Bolts:
public class PhpActivateGiftCardBolt extends ShellBolt implements IRichBolt {
public PhpActivateGiftCardBolt() {
super("php", "order_processing/activate_giftcard.php");
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("order_id"));
}
@Override
public Map<String, Object> getComponentConfiguration() {
return null;
}
}
and how I;'m connecting them
builder.setBolt("activate_gc", new ActivateGiftCardBolt(), 4)
.shuffleGrouping("order_id");
builder.setBolt("send_gc_email", new SendGiftCardEmailBolt(), 4)
.shuffleGrouping("activate_gc");
When I remove the ack, the topology fails because of the lack of acked tuples, but when I call the ack method, the topology fails because it is failing acked/non-existant tuples.
Any idea why this happens?
While running a Topology, it seems as if php bolts are not propagating the message to the next bolt until they receive something from the previous bolt (or spout). As opposed to sending emitting/receiving a tuple once the previous bolt emits.
Any ideas?
dose it work with Storm 0.10.* or later?
I would to test your great Storm addon.
I used storm-starter with somme modification to use the following PHP file for replacement of splitsentence.py.
require_once 'storm-php/lib/storm.php';
class SplitSentenceBolt extends BasicBolt {
public function process(Tuple $tuple) {
$words = explode(' ', $tuple->values[0]);
foreach($words as $word)
$this->emit(array($word));
}
}
$splitsentence = new SplitSentenceBolt();
$splitsentence->run();
I run the WordCountTopology example. It seems to be ok ...
2914 [Thread-22] INFO backtype.storm.daemon.executor - Processing received message source: spout:8, stream: default, id: {}, [four score and seven years ago]
2923 [Thread-25] INFO backtype.storm.daemon.task - Emitting: split default ["four"]
2924 [Thread-25] INFO backtype.storm.daemon.task - Emitting: split default ["score"]
2929 [Thread-18] INFO backtype.storm.daemon.executor - Processing received message source: split:5, stream: default, id: {}, ["four"]
2929 [Thread-25] INFO backtype.storm.daemon.task - Emitting: split default ["and"]
2930 [Thread-18] INFO backtype.storm.daemon.task - Emitting: count default [four, 1]
but very few seconds after, i think the PHP process died :
3091 [Thread-22] ERROR backtype.storm.util - Async loop died!
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Pipe to subprocess seems to be broken! No output read.
Shell Process Exception:
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:87)
at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:58)
at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:62)
at backtype.storm.daemon.executor$fn__4043$fn__4052$fn__4099.invoke(executor.clj:658)
at backtype.storm.util$async_loop$fn__465.invoke(util.clj:377)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Pipe to subprocess seems to be broken! No output read.
Shell Process Exception:
at backtype.storm.task.ShellBolt.execute(ShellBolt.java:139)
at backtype.storm.daemon.executor$fn__4043$tuple_action_fn__4045.invoke(executor.clj:566)
at backtype.storm.daemon.executor$mk_task_receiver$fn__3969.invoke(executor.clj:345)
at backtype.storm.disruptor$clojure_handler$reify__1599.onEvent(disruptor.clj:43)
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:84)
... 6 more
Caused by: java.lang.RuntimeException: Pipe to subprocess seems to be broken! No output read.
Shell Process Exception:
at backtype.storm.utils.ShellProcess.readString(ShellProcess.java:100)
at backtype.storm.utils.ShellProcess.readMessage(ShellProcess.java:62)
at backtype.storm.task.ShellBolt$1.run(ShellBolt.java:90)
... 1 more
3103 [Thread-22] ERROR backtype.storm.daemon.executor -
Did you already encounter this problem ?
Thanks
Php Bolts seem to passively accept tuples. The previous worker can emit a tuple, but a bolt will not process the first tuple until the worker emits a second tuple. (Hence the last tuple never gets processed)
While I can use storm-php for my bolts I have very high CPU load.
This is probably because of while(true) $line = trim($this->readLine()); ?
If this is the case should we implement usleep or something to ease off when no data is coming ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.