目前我们的同一个服务既提供spring web服务又提供dubbo服务。 dubbo的配置如下:
dubbo:
application:
name: ${spring.application.name}
id: ${spring.application.name}
register-mode: instance
logger: slf4j
shutwait: 5000
protocol:
id: dubbo
name: dubbo
port: -1
serialization: hessian2
registry:
address: nacos://@nacos.server@
config-center:
address: nacos://@nacos.server@
metadata-report:
address: nacos://@nacos.server@
scan:
base-packages: com.xxx
consumer:
check: false
provider:
threads: 500
delay: 10000
使用docker stop关闭服务的时候 dubbo服务会先关闭,不接收请求,然后spring也会关闭服务。但是问题是dubbo关闭后spring还有请求过来,导致spring 请求中有调用其他dubbo服务的就会报如下错误:
java.util.concurrent.ExecutionException: org.apache.dubbo.rpc.RpcException: Directory of type RegistryDirectory already destroyed for service com.xxx.user.rpc.UserRpc from registry nacos://192.168.100.240:8848/org.apache.dubbo.registry.RegistryService?application=xxx-service&dubbo=2.0.2&environment=product&executor-management-mode=isolation&file-cache=true&logger=slf4j&organization=xx&owner=xxx&pid=1&qos.enable=true&qos.port=28029®ister-mode=instance&release=3.2.0&serialize.check.status=WARN&shutwait=5000×tamp=1689590386952
请问怎么手动关闭dubbo服务,我想的是在spring boot的shutdownHook中手动关闭dubbo服务来解决。但是官方文档好像没有这一块的内容。