增加服务降级处理机制

This commit is contained in:
shuzheng 2017-02-14 11:26:58 +08:00
parent 834c0e4df5
commit e806858dd9
18 changed files with 221 additions and 37 deletions

View File

@ -9,19 +9,19 @@
<dubbo:application name="zheng-cms-admin"/>
<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!-- 订阅服务 -->
<dubbo:consumer check="false"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService" mock="true"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService" mock="true"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService" mock="true"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService" mock="true"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService" mock="true"/>
</beans>

View File

@ -9,19 +9,19 @@
<dubbo:application name="zheng-cms-job"/>
<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!-- 订阅服务 -->
<dubbo:consumer check="false"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService" mock="true"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService" mock="true"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService" mock="true"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService" mock="true"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService" mock="true"/>
</beans>

View File

@ -0,0 +1,14 @@
package com.zheng.cms.rpc.api;
import com.zheng.cms.dao.mapper.CmsArticleMapper;
import com.zheng.cms.dao.model.CmsArticle;
import com.zheng.cms.dao.model.CmsArticleExample;
import com.zheng.common.base.BaseServiceMock;
/**
* 降级实现CmsArticleService接口
* Created by shuzheng on 2017/2/14.
*/
public class CmsArticleServiceMock extends BaseServiceMock<CmsArticleMapper, CmsArticle, CmsArticleExample> implements CmsArticleService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.cms.rpc.api;
import com.zheng.cms.dao.mapper.CmsCategoryMapper;
import com.zheng.cms.dao.model.CmsCategory;
import com.zheng.cms.dao.model.CmsCategoryExample;
import com.zheng.common.base.BaseServiceMock;
/**
* 降级实现CmsCategoryService接口
* Created by shuzheng on 2017/2/14.
*/
public class CmsCategoryServiceMock extends BaseServiceMock<CmsCategoryMapper, CmsCategory, CmsCategoryExample> implements CmsCategoryService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.cms.rpc.api;
import com.zheng.cms.dao.mapper.CmsCommentMapper;
import com.zheng.cms.dao.model.CmsComment;
import com.zheng.cms.dao.model.CmsCommentExample;
import com.zheng.common.base.BaseServiceMock;
/**
* 降级实现CmsCommentService接口
* Created by shuzheng on 2017/2/14.
*/
public class CmsCommentServiceMock extends BaseServiceMock<CmsCommentMapper, CmsComment, CmsCommentExample> implements CmsCommentService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.cms.rpc.api;
import com.zheng.cms.dao.mapper.CmsPageMapper;
import com.zheng.cms.dao.model.CmsPage;
import com.zheng.cms.dao.model.CmsPageExample;
import com.zheng.common.base.BaseServiceMock;
/**
* 降级实现CmsPageService接口
* Created by shuzheng on 2017/2/14.
*/
public class CmsPageServiceMock extends BaseServiceMock<CmsPageMapper, CmsPage, CmsPageExample> implements CmsPageService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.cms.rpc.api;
import com.zheng.cms.dao.mapper.CmsSettingMapper;
import com.zheng.cms.dao.model.CmsSetting;
import com.zheng.cms.dao.model.CmsSettingExample;
import com.zheng.common.base.BaseServiceMock;
/**
* 降级实现CmsSettingService接口
* Created by shuzheng on 2017/2/14.
*/
public class CmsSettingServiceMock extends BaseServiceMock<CmsSettingMapper, CmsSetting, CmsSettingExample> implements CmsSettingService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.cms.rpc.api;
import com.zheng.cms.dao.mapper.CmsTagMapper;
import com.zheng.cms.dao.model.CmsTag;
import com.zheng.cms.dao.model.CmsTagExample;
import com.zheng.common.base.BaseServiceMock;
/**
* 降级实现CmsTagService接口
* Created by shuzheng on 2017/2/14.
*/
public class CmsTagServiceMock extends BaseServiceMock<CmsTagMapper, CmsTag, CmsTagExample> implements CmsTagService {
}

View File

@ -9,28 +9,28 @@
<dubbo:application name="zheng-cms-rpc-service"/>
<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<dubbo:protocol name="dubbo" port="20880"/>
<!-- 文章 -->
<bean id="cmsArticleServiceImpl" class="com.zheng.cms.rpc.service.impl.CmsArticleServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsArticleService" ref="cmsArticleServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsArticleService" ref="cmsArticleServiceImpl" timeout="10000"/>
<!-- 类目 -->
<bean id="cmsCategoryServiceImpl" class="com.zheng.cms.rpc.service.impl.CmsCategoryServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsCategoryService" ref="cmsCategoryServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsCategoryService" ref="cmsCategoryServiceImpl" timeout="10000"/>
<!-- 评论 -->
<bean id="cmsCommentServiceImpl" class="com.zheng.cms.rpc.service.impl.CmsCommentServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsCommentService" ref="cmsCommentServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsCommentService" ref="cmsCommentServiceImpl" timeout="10000"/>
<!-- 标签 -->
<bean id="cmsTagServiceImpl" class="com.zheng.cms.rpc.service.impl.CmsTagServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsTagService" ref="cmsTagServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.CmsTagService" ref="cmsTagServiceImpl" timeout="10000"/>
<!-- 用户 -->
<bean id="userServiceImpl" class="com.zheng.cms.rpc.service.impl.UserServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.UserService" ref="userServiceImpl"/>
<dubbo:service interface="com.zheng.cms.rpc.api.UserService" ref="userServiceImpl" timeout="10000"/>
</beans>

View File

@ -9,19 +9,19 @@
<dubbo:application name="zheng-cms-search"/>
<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!-- 订阅服务 -->
<dubbo:consumer check="false"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService" mock="true"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService" mock="true"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService" mock="true"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService" mock="true"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService" mock="true"/>
</beans>

View File

@ -9,19 +9,19 @@
<dubbo:application name="zheng-cms-web"/>
<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!-- 订阅服务 -->
<dubbo:consumer check="false"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService"/>
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService" mock="true"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService"/>
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService" mock="true"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService"/>
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService" mock="true"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService"/>
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService" mock="true"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService"/>
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService" mock="true"/>
</beans>

View File

@ -0,0 +1,30 @@
package com.zheng.upms.rpc.api;
import com.zheng.upms.dao.model.UpmsPermission;
import com.zheng.upms.dao.model.UpmsRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* 降级实现UpmsApiService接口
* Created by shuzheng on 2017/2/14.
*/
public class UpmsApiServiceMock implements UpmsApiService {
private static Logger _log = LoggerFactory.getLogger(UpmsApiServiceMock.class);
@Override
public List<UpmsPermission> selectUpmsPermissionByUpmsUserId(Integer upmsUserId) {
_log.info("UpmsApiServiceMock => selectUpmsPermissionByUpmsUserId");
return null;
}
@Override
public List<UpmsRole> selectUpmsRoleByUpmsUserId(Integer upmsUserId) {
_log.info("UpmsApiServiceMock => selectUpmsRoleByUpmsUserId");
return null;
}
}

View File

@ -0,0 +1,14 @@
package com.zheng.upms.rpc.api;
import com.zheng.common.base.BaseServiceMock;
import com.zheng.upms.dao.mapper.UpmsOrganizationMapper;
import com.zheng.upms.dao.model.UpmsOrganization;
import com.zheng.upms.dao.model.UpmsOrganizationExample;
/**
* 降级实现UpmsOrganizationService接口
* Created by shuzheng on 2017/2/14.
*/
public class UpmsOrganizationServiceMock extends BaseServiceMock<UpmsOrganizationMapper, UpmsOrganization, UpmsOrganizationExample> implements UpmsOrganizationService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.upms.rpc.api;
import com.zheng.common.base.BaseServiceMock;
import com.zheng.upms.dao.mapper.UpmsPermissionMapper;
import com.zheng.upms.dao.model.UpmsPermission;
import com.zheng.upms.dao.model.UpmsPermissionExample;
/**
* 降级实现UpmsPermissionService接口
* Created by shuzheng on 2017/2/14.
*/
public class UpmsPermissionServiceMock extends BaseServiceMock<UpmsPermissionMapper, UpmsPermission, UpmsPermissionExample> implements UpmsPermissionService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.upms.rpc.api;
import com.zheng.common.base.BaseServiceMock;
import com.zheng.upms.dao.mapper.UpmsRoleMapper;
import com.zheng.upms.dao.model.UpmsRole;
import com.zheng.upms.dao.model.UpmsRoleExample;
/**
* 降级实现UpmsRoleService接口
* Created by shuzheng on 2017/2/14.
*/
public class UpmsRoleServiceMock extends BaseServiceMock<UpmsRoleMapper, UpmsRole, UpmsRoleExample> implements UpmsRoleService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.upms.rpc.api;
import com.zheng.common.base.BaseServiceMock;
import com.zheng.upms.dao.mapper.UpmsSystemMapper;
import com.zheng.upms.dao.model.UpmsSystem;
import com.zheng.upms.dao.model.UpmsSystemExample;
/**
* 降级实现UpmsSystemService接口
* Created by shuzheng on 2017/2/14.
*/
public class UpmsSystemServiceMock extends BaseServiceMock<UpmsSystemMapper, UpmsSystem, UpmsSystemExample> implements UpmsSystemService {
}

View File

@ -0,0 +1,14 @@
package com.zheng.upms.rpc.api;
import com.zheng.common.base.BaseServiceMock;
import com.zheng.upms.dao.mapper.UpmsUserMapper;
import com.zheng.upms.dao.model.UpmsUser;
import com.zheng.upms.dao.model.UpmsUserExample;
/**
* 降级实现UpmsUserService接口
* Created by shuzheng on 2017/2/14.
*/
public class UpmsUserServiceMock extends BaseServiceMock<UpmsUserMapper, UpmsUser, UpmsUserExample> implements UpmsUserService {
}

View File

@ -9,22 +9,22 @@
<dubbo:application name="zheng-upms-server"/>
<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!-- 订阅服务 -->
<dubbo:consumer check="false"/>
<!-- 系统 -->
<dubbo:reference id="upmsSystemService" interface="com.zheng.upms.rpc.api.UpmsSystemService"/>
<dubbo:reference id="upmsSystemService" interface="com.zheng.upms.rpc.api.UpmsSystemService" mock="true"/>
<!-- 组织 -->
<dubbo:reference id="upmsOrganizationService" interface="com.zheng.upms.rpc.api.UpmsOrganizationService"/>
<dubbo:reference id="upmsOrganizationService" interface="com.zheng.upms.rpc.api.UpmsOrganizationService" mock="true"/>
<!-- 用户 -->
<dubbo:reference id="upmsUserService" interface="com.zheng.upms.rpc.api.UpmsUserService"/>
<dubbo:reference id="upmsUserService" interface="com.zheng.upms.rpc.api.UpmsUserService" mock="true"/>
<!-- 角色 -->
<dubbo:reference id="upmsRoleService" interface="com.zheng.upms.rpc.api.UpmsRoleService"/>
<dubbo:reference id="upmsRoleService" interface="com.zheng.upms.rpc.api.UpmsRoleService" mock="true"/>
<!-- 权限 -->
<dubbo:reference id="upmsPermissionService" interface="com.zheng.upms.rpc.api.UpmsPermissionService"/>
<dubbo:reference id="upmsPermissionService" interface="com.zheng.upms.rpc.api.UpmsPermissionService" mock="true"/>
<!-- 接口服务 -->
<dubbo:reference id="upmsApiService" interface="com.zheng.upms.rpc.api.UpmsApiService"/>
<dubbo:reference id="upmsApiService" interface="com.zheng.upms.rpc.api.UpmsApiService" mock="true"/>
</beans>