Esframework introduction (13) -- function plug-in processor Factory

Source: Internet
Author: User
The above describes the as-based message processor based on the connection pool. Now we will focus on the function server FS to see the process of message distribution on FS. When FS receives a request, it selects an appropriate plug-in from the list of loaded function plug-ins to process the message, and each function plug-in is equivalent to a message processor. The structure of FS and as is consistent:

Note that the function Server FS All received messages should be handed over to the function plug-in for processing. There are no other processing methods. This makes FS "Pure" requirements. The location and role of the function plug-in processor factory are clearly indicated. It uses the plug-in Manager to implement the "Factory" function. Its implementation is very simple, as shown below:

1 ///   <Summary>
2 /// Addindealerfactory function plug-in processor factory, each function plug-in can be converted into a processor
3 ///   </Summary>
4 Public   Class Funaddindealerfactory: idatadealerfactory
5 {
6 Private Iaddinmanagement addinmanagement;
7
8 Public Funaddindealerfactory ()
9 {
10 }
11
12 # Region Property
13 Public Iaddinmanagement addinmanagement
14 {
15 Set
16 {
17 This . Addinmanagement = Value;
18 }
19 }
20 # Endregion
21
22 # Region Idatadealerfactory Member
23 Public Idatadealer createdealer ( Int Requesttype, Int Servertypekey)
24 {
25 Foreach (Iaddin addin In   This . Addinmanagement. addinlist)
26 {
27 If (Addin. servicekey = Requesttype) && (Addin. enabled ))
28 {
29 Return (Idatadealer) addin;
30 }
31 }
32
33 Return   Null ;
34 }
35
36 # Endregion
37 }


As mentioned above, each function plug-in must be self-supplied. Some may have their own configuration files, and some may need to access the database or externalWebServiceAnd so on. Temporarily,FSThe dependency between functional plug-ins is not yet supported-Each plug-in must be independent of each other.
In the preceding example, the function plug-in needs to accessHttp://www.webservicex.net/globalweather.asmxOfWebService. Like this:

The content of this article is very simple, and the figure above basically describes the main structure of FS. We will pay attention to the non-functional communication between AS and FS, and explain how the entire platform dynamically adds/removes FS, and how to explain in the case of unstable network, ensures good communication between AS and FS. Thanks for your attention.

Previous Article: esframework (12)-message processor based on TCP Connection Pool

Go to: esframework reusable Communication Framework (sequence)

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.