Consider a storm DRPC topology which is as follows:
public static void main(String[] args) {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclamationBolt());
Config conf = new Config();
try {
StormSubmitter.submitTopology("exclaim", conf, builder.createRemoteTopology());
} catch (AlreadyAliveException e) {
e.printStackTrace();
} catch (InvalidTopologyException e) {
e.printStackTrace();
}
}
Tested with LocalCluster
i.e drpc.execute("exclamation", "aaa")
, it works. But question is how to call remotely from the PHP?
thrift --gen php storm.thrift
& got a gen-php directory with a bunch of php classes.Could anyone give an example or link showing implementation?
We just need to write an abstraction layer on top of the generated class files, exactly like the java client.
You can generate the drpc class files by:
thrift --gen php storm.thrift
and you have to require the php-thrift library in your code.
I have put the working code here in below repo: