Dubbo as a consumer registration process analysis, dubbo consumer
Support Originality: the current analysis version of The http://www.cnblogs.com/donlianli/p/3847676.html author is 2.5.x. During the analysis, I checked the Code with questions and debug the debugging. I wrote this article for reference only. First, let's take a rough look at the process of the system as a consumer from startup to registration: 1. Which class does dubbo use to interact with zookeeper? 2. Which class does dubbo store the subscribed information?
RegistryProtocol. doRefer indicates that FailbackRegistry. registry is called for real registration. It actually interacts with zookeeper and calls the ZookeeperRegistry's doRegistry method. If the registration fails, the url is added to the scheduled task for retry.
Zooactregistry. zooy actually receives notifications from zookeeper. Where can I add the notify interface to the zookeeper change event? In the doSubscribe method of ZookeeperRegistry code (in code that interacts with zookeeper), send the subscribed interface to zookeeper and obtain the available service list from zookeeper. ZookeeperRegistry code:
ZkClient. create (path, false); // This is the List of services subscribed by zookeeper. <String> children = zkClient. addChildListener (path, zkListener); if (children! = Null) {urls. addAll (toUrlsWithEmpty (url, path, children);} outside the loop, notify the available list. Required y (url, listener, urls);, called AbstractRegistry. Required y
After receiving the notification, wannactregistry stores the url and continues to notify yylistener. Where is policylistener placed in the Registry? The RegistryDirectory. subscribe method is called when RegistryProtocol subscribes to the service. RegistryDirectory implements the policylistener interface. When you call the subscribe method of FailbackRegistry, you use yourself as a parameter and pass it to the AbstractRegistry object. Therefore, RegistryDirectory continues to be notified after receiving the notification. RegistryDirectory maintains the mappings between local methods and remote methods, and the call relationships between remote parameters and local methods. Several main classes in the registration process
ZookeeperRegistry: Responsible for interacting with zookeeper
RegistryProtocol: Obtain available services from the registration center, or register the services to zookeeper, and then provide services or call agents.
RegistryDirectory: Maintain all available remote Invoker or local Invoker. This class implements policylistner.
NotifyListener: Responsible for communications between RegistryDirectory and ZookeeperRegistry.
FailbackRegistrY: inherits from the Registry and implements the retry failure mechanism. Answer the first question 1. Pass
ZookeeperRegistryInteracts with Zookeeper. The related classes include ZookeeperClient, ZkclientZookeeperClient, and org. I0Itec. zkclient. ZkClient. Through these methods, the Service Registration and subscription and information transmission are realized. 2. The main classes are AbstractRegistry and RegistryDirectory. The RegistryDirectory stores Invoker that can be directly called by the client, while the AbstractRegistry class mainly stores registered service interfaces, subscribed service interfaces, and URLs of interfaces that have received notifications, cannot be called directly. About me, Handan. Interested in such topics? Send an email
Donlianli@126.com
Take your shopping experience as an example to analyze the consumer's purchase decision-making process
Let me give you an example. Summer is coming. In order to prevent the sun from shining on the skin, it will arouse my desire to buy sunscreen, then I went to my friend's website to search for all kinds of information about the sunscreen products. By comparing them, I decided to place an order to buy products that are cost-effective and suitable for my skin. After purchasing the product, you can use it to evaluate the satisfaction of the product.
Consumer purchase decision-making process
(1) cause a need
(2) Sources of consumer information collected mainly include personal sources (such as family, friends, neighbors, acquaintances) and commercial sources (such as advertisements, salesmen, dealers, packaging, and exhibitions), public sources (such as mass media, consumer review organizations), and experience sources (such as processing, checking, and using products.
(3) Evaluation Scheme 1. product attributes. That is, the product can meet the needs of consumers. 2. Attribute Weight. That is, different importance weights granted by consumers to product-related attributes. 3. Brand belief. 4. utility functions. 5. evaluation model.
(4) decide to purchase
(5) After the purchase, the buyer's satisfaction with his/her purchase activities (S) is a function of his/her product expectations (E) and the product's perceptible performance (P, that is, S = F (E, P ). If E = P, the consumer will be satisfied. If E> P, the consumer will be dissatisfied.
How to analyze consumers 001
Theme 1 consumer analysis [Theme key points] consumer analysis is the first step in conducting various economic behaviors such as marketing, advertising profit, brand and Marketing Planning, product design and production, and enterprise public relations. If the consumer analysis is incomplete or fails, all economic behaviors will fail. Therefore, consumer analysis is not a dispensable task, but a major issue that enterprises must seriously study and consider. ※Consumer analysis is critical. For consumer analysis, the most critical issue is research: the level of demand that consumers generally belong. Enterprises can refer to Maslow's hierarchy of needs theory. The level of human needs is: first, we need to meet physiological survival needs. Without them, all problems are "water in the moon, flowers in the mirror". After meeting the survival needs, we need security, in this way, we need to enjoy the social and sense of belonging in a group. When people live in social activities, they naturally need to gain self-esteem or be respected; after gaining self-esteem and respect from others, people finally find that in addition to this social circle, there are more advanced and better social circles to reach this social circle, self-improvement is required. This is the highest level of self-fulfillment requirement at the requirement level. ※Test method. The most common method for consumer analysis is the survey and testing method. Its general principle is to select a part of the target consumer group as a sample, and to understand the demand characteristics of the respondents through questionnaires, interviews, seminars, discussions, observations, and realism. For example, purchasing motivation, functional preferences, emotional characteristics, aesthetic preferences, and behavioral habits. Summarize and summarize some general and regular conclusions based on the sample data. Or, the sample consumer evaluates the pre-designed product "selling points" and "Concepts, to test whether the value of a product (service) can meet the needs of consumers and the degree of satisfaction. However, it also has some problems that enterprises need to pay attention. Table 1.1.1 insufficient countermeasures for investigation and testing the sample size. In this case, the enterprise should reduce the proportion based on the size and product nature of the target market. As the scale expands, the proportion decreases. Sample structure problems the distribution of the sample consumers may be different from that of the entire consumer group. The proportion of male in the overall consumer group is 60%, and that of female is 40%. If the proportion in the sample consumer group is reversed, the survey and test results are obviously untrustworthy. The authenticity of consumers' opinions is because many consumers often hide their true intentions to meet public opinions and moral requirements. When a consumer asks "do you like innovative products?", even those who do not like it often say "I like" with good enthusiasm ".