Questions tagged [gen-fsm]

gen_fsm stands for "generic finite state machine", a module behaviour in Erlang.

24 questions
1
vote
1 answer

Can I handle any received message in gen_fsm state callbacks?

I noticed that messages sent to the pid of a gen_fsm process are matched in the state callbacks as events. Is this just accidental or can I rely on this feature? Normally I would expect general messages sent to a gen_fsm to show up in the…
Peer Stritzinger
  • 8,232
  • 2
  • 30
  • 43
1
vote
1 answer

Which Erlang behaviour i.e. gen_server or gen_fsm should I use in this case

I am developing a solution that queries a SOAP web service for certain transactions. Once retrieved, these transactions are meant to be saved in a database after which a callback url is invoked to send some data to another server. How would you best…
Waliaula Makokha
  • 815
  • 1
  • 11
  • 21
1
vote
2 answers

Can i use "sender" in Akka FSM code?

class RulesFSMActor extends Actor with FSM[State, Data]{ When(Rule1) { case Event(CASE_MSG1, Data) => if () goto(Rule2) } When(Rule2) { case Event(CASE_MSG2, Data) => if (){ …
Avis
  • 496
  • 1
  • 5
  • 18
1
vote
3 answers

handle illegality events while not clearing timeout in gen_fsm behaviour

There is an locked door example about gen_fsm in the Elrang Otp System Documentation. I have a question about timeout. I will copy the code here…
Bin Wang
  • 2,697
  • 2
  • 24
  • 34
1
vote
2 answers

Ensure that gen_fsm/gen_server process exists while sending a message

What is the most recommended way in Erlang to ensure that some process exists before sending a message / event to it? In my scenario I am starting process upon first occurrence of the message and then it stays alive. While keep passing further…
mkorszun
  • 4,461
  • 6
  • 28
  • 43
0
votes
1 answer

erlang:send_after message delay

I have following code: send_event_at({TsMsec,Msg}) -> Now = os:system_time(micro_seconds), NowMsec = erlang:convert_time_unit(Now,micro_seconds,milli_seconds), DelayMsec = TsMsec - NowMsec, if DelayMsec >= 0 -> …
Anton Prokofiev
  • 937
  • 10
  • 28
0
votes
1 answer

Erlang - Exception exit on supervisor and gen_fsm

I have 3 modules: calculadora, log_calculadora and supervisor_calculadora. Calculadora is just a simple calculator that makes sum, subtraction, multiplication and division using gen_fsm and supervisor implements supervisor behaviour. Calculadora…
0
votes
2 answers

Change gen_fsm state to a function in a different module

We have a fairly large USSD application that uses Erlang's gen_fsm module to manage the menu options. The current version has a single menus_fsm.erl file that contains 5000+ lines gen_fsm related code. Our next version gives us an opportunity to…
Wernsey
  • 5,411
  • 22
  • 38
-3
votes
2 answers

Get gen_fsm PID

I start gen_fsm: start_link() -> gen_fsm:start_link({global, ?MODULE}, [], []). How can i get it's PID? Thank you.
0xAX
  • 20,957
  • 26
  • 117
  • 206
1
2