dongqiang5932 2013-12-13 10:18
浏览 47
已采纳

如何从PHP调用DRPC Storm?

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?


Update: I had installed thrift and generated the PHP by running 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?

  • 写回答

1条回答 默认 最新

  • dqppv86022 2014-01-02 04:26
    关注

    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:

    https://github.com/mithunsatheesh/php-drpc

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探