我正在研究MQTT代理(http://www.emqtt.io),它是用Erlang编写的。我有一个用例,我需要从erlang编写的emqtt代理代码中调用我的一个python模块。
我已经在google中检查过 erlport (http://erlport.org/),它用于erlang和python之间的端口通信。它在erlang shell中工作得很好,但是当我在emqtt erlang代码中使用它时,它不起作用。它会抛出如下所示的错误
17:22:40.073 <0.717.0> [error] gen_server <0.717.0> terminated with reason: call to undefined function python:start()
17:22:40.073 <0.717.0> [error] CRASH REPORT Process <0.717.0> with 1 neighbours exited with reason: call to undefined function python:start() in gen_server2:terminate/3 line 1151
17:22:40.073 <0.631.0> [error] Supervisor emqttd_session_sup had child session started with {emqttd_session,start_link,undefined} at <0.717.0> exit with reason call to undefined function python:start() in context child_terminated
17:22:40.073 <0.677.0> [error] Supervisor 'esockd_connection_sup - <0.677.0>' had child connection started with emqttd_client:start_link([{packet,[{max_clientid_len,512},{max_packet_size,65536}]},{client,[{idle_timeout,30}]},{session,...},...]) at <0.716.0> exit with reason call to undefined function python:start() in context connection_crashed
我们从emqtt插件代码调用python模块,代码更改显示在下面
on_message_acked(ClientId, Message, _Env) ->
io:format("client ~s acked: ~s~n", [ClientId, emqttd_message:format(Message)]),
io:format("client ~s",[python:start()]),
{ok, Message}.
请帮助我们。