Erlang custom gen_container behavior mode development

Source: Internet
Author: User

1. Functions completed by gen_container Action Mode

Gen_container features: Container startup and shutdown, the same asynchronous message distribution processing of messages, obtaining the number of container instances, obtaining the list of running instances in the container, enabling the instance hot plugging to dynamically add and delete instances, creating and monitoring instances, management and Maintenance after destruction and exit.

2. This behavior mode is divided into two queues: online and offline. An instance is running in the current container. The offline queue stores all the instances that can be managed by the current container and stores them in beanlist as a list and saved in state.

3. gen_container action mode process

4. Summary of development behavior patterns.

The development behavior mode must consider the behavior mode itself (Template) and the callback module that implements the behavior mode. You need to carefully consider how the callback module is called. In the behavior mode module, hold the module name of the callback module when it is started, and then enter the polling of the received message. After receiving the message, by matching the message and executing the callback function corresponding to the callback module, You can associate the common function with the callback function. To some extent, the behavior pattern is a manifestation of polymorphism. A common function can be mapped to the execution of different callback functions.

 

Erlang custom gen_container behavior mode development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.