# Issue 1:xml configuration for shutdown ## 1、Basic concepts ### Graceful Shutdown Dubbo's native support for graceful downtime is based on the configured file named “dubbo.properties”. We added the value as follows: > Dubbo.service.shutdown.wait=XX
that is to say, Dubbo stops receiving tasks, and waits for the completion of existing tasks, waiting for XX milleseconds. ### Configuration 1) Properties Configuration "dubbo.properties": it stores the configuration information shared by multiple containers and acts as a micro-registration center. It initialize the configuration through jvm. 2) Xml configuration: we use the .xml to decouples the configuration of each component of dubbo. And bind with individual own configuration class and configuration tag, which is more friendly to the system development. See more details: > Http://dubbo.apache.org/en/us/docs/user/references/xml/introduction.html ## 2. Solution We configure the timeout for graceful shutdown in the xml file. For the tag named <dubbo:registry>, there is a parameter “wait”,  which denoted the timeout. ## 3. Implementation  Add a wait tag in the provider.xml. ## 4. Result   # Issue 2: expose application for provider ## Problems It is difficult for provider side to quickly locate which consumer's request has a problem. Thus the Dubbo needs to support application name in the url for better development experience. ## Solution 1) Consumer We define the application name in the “consumer.xml”  2) RpcContext RpcContext is a java class, defining a lot of parameters passed between the provider and consumer during the Remote Procedure Call. Thus we need to expand RpcContext.java to send the application name. 3) ConsumerContextFilter Before the consumer calls the remote service, we first call the invoke() method of the ConsumerContextFilter. And the method initializes the values of the RPC context information including the application name. 4) Provider The service provider can get the application name from the RpcContext. ## Implementation ### Solution 1. We tried two solutions when solving this problem. The first one is to add a new field “applicationName” to support the application name and two methods: setapplicationName() and getapplicationName() in RpcContext class. Then we add RpcContext. setapplicationName() in the invoke() of ComsumerContextFilter class. But when we use the getapplicationName() method to get the application information in the provider side, the value appears null. The protocol does not support the extension. ### Solution 2. After careful review, it is found that there is an attachments field in the RpcContext, which supports the developer to extend the field value in the form of a key-value. Details can be seen as follows: First, in the ConsumerContextFilter, we add the setAttachment() in invoke() method. The key is "Constants.APPLICATION_KEY" and the value can be extracted from the url.  ## Result   # Issue 3: support register host Dubbo has supported Providers to register their host to the registry server, and registry server can automatically get the IP by host name. Firstly:configure the host name of provider in the xml configuration file, the configuration is:  Secondly: In the ContextFilter, we add the NetUtil.getIpByHost method to map the host to Ip. You could try like this.  ## Result  [ Full content available at: https://github.com/apache/incubator-dubbo/issues/2397 ] This message was relayed via gitbox.apache.org for [email protected]
