Skip to content

Commit

Permalink
Support customized origin parser in legacy Dubbo 2.6.x adapter (aliba…
Browse files Browse the repository at this point in the history
  • Loading branch information
cityiron authored and mastertiller committed Aug 20, 2020
1 parent 579c795 commit 4e71d16
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sentinel-adapter/sentinel-dubbo-adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,10 @@ flow control, degrade or system load protection. You can implement your own `Dub
and then register to `DubboAdapterGlobalConfig`.
If no fallback is configured, Sentinel will wrap the `BlockException` as the fallback result.

Besides, we can also leverage [Dubbo mock mechanism](http://dubbo.apache.org/en-us/docs/user/demos/local-mock.html) to provide fallback implementation of degraded Dubbo services.
Besides, we can also leverage [Dubbo mock mechanism](http://dubbo.apache.org/en-us/docs/user/demos/local-mock.html) to provide fallback implementation of degraded Dubbo services.

## Global dubbo provider origin parse

Sentinel Dubbo Adapter supports global origin parse for provider.
You can implement your own `DubboOriginParser` interface
and then register to `DubboOriginParserRegistry`. If no originParse is configured, Sentinel will user dubbo url property application.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.csp.sentinel.adapter.dubbo.origin;

/**
* Global origin parser registry for Dubbo.
*
* @author tiecheng
*/
public final class DubboOriginParserRegistry {

private static volatile DubboOriginParser dubboOriginParser = new DefaultDubboOriginParser();

public static DubboOriginParser getDubboOriginParser() {
return dubboOriginParser;
}

public static void setDubboOriginParser(DubboOriginParser dubboOriginParser) {
DubboOriginParserRegistry.dubboOriginParser = dubboOriginParser;
}

private DubboOriginParserRegistry() {}

}

0 comments on commit 4e71d16

Please sign in to comment.