Types of module behaviours in Erlang?

Total Post:107


 993  View(s)
Rate this:
  1. Types of module behaviours in Erlang?

    Behaviours are like patterns which makes easier to understand the erlang code to every Erlang programmer. The idea behind the Behaviour is to divide the Erlang code for a process in a generic part (means: a behaviour module) and a callback module.

    There are different types of behaviours in Erlang, some of them are as follows:
    1. gen_server: gen_server allows to send and receive sync and async messages, start and stop processes and allows to code change.
    2. gen_event: gen_event is used for implementing event handling functionality and the OTP event handling model consists of a generic event manager process with an arbitrary number of event handlers that are added and deleted dynamically.
    3. supervisor: supervisor is used for monitoring processes and we can implement a good shutdown and restart strategy around it.
    4. gen_fsm: gen_fsm allows changes whether there are too many states involve in an application.
    5. gen_mod: gen_mod provides the facility to extend the ejabberd modules with the xmpp server have to implement gen_mod behaviour. And also it has start/2 and stop/1 functions that allows us to intergrate the custom functions of our module. 

      Modified On Mar-28-2018 06:16:26 AM