otp

How to find the supervisor of an OTP process?

若如初见. 提交于 2019-12-01 16:51:08
Are there functions which would allow an OTP process to find the pid of its supervisor? The data is hidden in the process dictionary (of any process spawned with proc_lib ) under the entry '$ancestors' : 1> proc_lib:spawn(fun() -> timer:sleep(infinity) end). <0.33.0> 2> i(0,33,0). [{current_function,{timer,sleep,1}}, {initial_call,{proc_lib,init_p,3}}, {status,waiting}, {message_queue_len,0}, {messages,[]}, {links,[]}, {dictionary,[{'$ancestors',[<0.31.0>]}, {'$initial_call',{erl_eval,'-expr/5-fun-1-',0}}]}, {trap_exit,false}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0

How to find the supervisor of an OTP process?

霸气de小男生 提交于 2019-12-01 16:07:57
问题 Are there functions which would allow an OTP process to find the pid of its supervisor? 回答1: The data is hidden in the process dictionary (of any process spawned with proc_lib ) under the entry '$ancestors' : 1> proc_lib:spawn(fun() -> timer:sleep(infinity) end). <0.33.0> 2> i(0,33,0). [{current_function,{timer,sleep,1}}, {initial_call,{proc_lib,init_p,3}}, {status,waiting}, {message_queue_len,0}, {messages,[]}, {links,[]}, {dictionary,[{'$ancestors',[<0.31.0>]}, {'$initial_call',{erl_eval,'

Java to Erlang messages

送分小仙女□ 提交于 2019-12-01 05:20:20
I'm making a application in Erlang, with a GUI in Java. I've managed to establish a connection between the to languages, but now i need to (i guess) send a message from Java to Erlang, every time I e.g press a button. Is that the right way to go? How would such a message look? I've found a few good sites about this form of integration, but I feel like im not getting everything. http://www.trapexit.org/How_to_communicate_java_and_erlang If jinterface is too complicated you might just use the packet option on open_port and use byte[] in_buf = new byte[256]; byte[] out_buf = new byte[256]; int in

Autofill OTP to the TextField when I receive message iPhone app

梦想的初衷 提交于 2019-12-01 00:45:20
问题 While registering from my app I was sending OTP to the registered mobile number I want to retrieve that OTP in my app without opening SMS app...When the user received OTP message I need to display that OTP here ...How can I achieve this in iOS? I also have user Phone number with me. On search, I have found this but I am not clear how to initiate this. Can anyone help me from this? 回答1: You cannot access messages on ios and hence you cannot autofill the OTP in ios apps by reading sms. The

How to design a flexible Erlang protocol stack creation API

好久不见. 提交于 2019-11-30 19:39:10
Unsatisfied with my current approach I'm just trying to redesign the way I build protocol stacks in Erlang. The feature ordered by importance: Performance Flexibility and implementation speed adding new protocol variants It would help development to explore the protocol variants from the shell My current model ( alreday described in this question ) is getting at its limits besides the ugly asymmetry of send() by function call and receive by message. The overall picture of the whole protocol engine looks like this: Bottom part: There a several ports or maybe also sometimes a gen_tcp at the

Building a fault-tolerant soft real-time web application with Erlang/OTP

蓝咒 提交于 2019-11-30 12:33:49
问题 I would like to build a fault-tolerant soft real-time web application for a pizza delivery shop. It should help the pizza shop to accept phone calls from customers, put them as orders into the system (via a CRM web client) and help the dispatchers to assign delivery drivers to the orders. These goals are nothing unusual, but I would like to make the service available 24/7, i.e. to make it fault-tolerant. Moreover, I would like to make it work very fast and to be very responsive. Below is a

Erlang: Distributed Application Strange behaviour

老子叫甜甜 提交于 2019-11-30 09:22:58
I'm paying with distributed erlang applications. Configuration and ideas are taken from: http:/www.erlang.org/doc/pdf/otp-system-documentation.pdf 9.9. Distributed Applications We have 3 nodes: n1@a2-X201, n2@a2-X201, n3@a2-X201 We have application wd that do some useful job :) Configuration files: wd1.config - for the first node: [{kernel, [{distributed,[{wd,5000,['n1@a2-X201',{'n2@a2-X201','n3@a2-X201'}]}]}, {sync_nodes_mandatory,['n2@a2-X201','n3@a2-X201']}, {sync_nodes_timeout,5000} ]} ,{sasl, [ %% All reports go to this file {sasl_error_logger,{file,"/tmp/wd_n1.log"}} ] }]. wd2.config for

Linux安装RabbitMQ

五迷三道 提交于 2019-11-30 07:57:40
一、安装Erlang环境 1、在安装erlang之前先安装下依赖文件(这一步不要忘掉了, 不然后面./configure的时候要报错): yum install gcc glibc-devel make ncurses-devel openssl-devel xmlto 2.到erlang官网去下载erlang安装包 wget -c http://erlang.org/download/otp_src_20.2.tar.gz 接下来解压: tar -zxvf otp_src_20.2.tar.gz cd otp_src_20.2/ 3. 编译安装 ./configure --prefix=/usr/local/erlang make && make install 4、测试安装是否成功: cd /usr/local/erlang/bin/ ./erl halt(). 退出控制台 5、配置环境变量 vim /etc/profile 在末尾加入这么一行即可:export PATH=$PATH:/usr/local/erlang/bin  source /etc/profile 二、安装rabbitmq  1、到官网下载最新安装包: http://www.rabbitmq.com/releases/rabbitmq-server/ wget -c http://www.rabbitmq

erlang OTP Supervisor crashing

喜欢而已 提交于 2019-11-30 07:13:33
问题 I'm working through the Erlang documentation, trying to understand the basics of setting up an OTP gen_server and supervisor. Whenever my gen_server crashes, my supervisor crashes as well. In fact, whenever I have an error on the command line, my supervisor crashes. I expect the gen_server to be restarted when it crashes. I expect command line errors to have no bearing whatsoever on my server components. My supervisor shouldn't be crashing at all. The code I'm working with is a basic "echo

what kind of types can be sent on an erlang message?

安稳与你 提交于 2019-11-30 05:22:07
Mainly I want to know if I can send a function in a message in a distributed erlang setup. on Machine 1 F1 = Fun()-> hey end, gen_server:call(on_other_machine,F1) on Machine 2 handler_call(Function,From,State) -> {reply,Function(),State) make sense? Here 's an interesting article about "passing fun's to other Erlang nodes". To resume it briefly: [...] As you might know, Erlang distribution works by sending the binary encoding of terms; and so sending a fun is also essentially done by encoding it using erlang:term_to_binary/1; passing the resulting binary to another node, and then decoding it