You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "lbh6771740 (via GitHub)" <gi...@apache.org> on 2023/05/31 08:29:50 UTC
[GitHub] [dubbo] lbh6771740 commented on issue #12434: 使用dubbo triple reactor 方式通信,当调用方程序被杀死停止后,服务提供方建立的流doFinally方法不会收到中断信号?
lbh6771740 commented on issue #12434:
URL: https://github.com/apache/dubbo/issues/12434#issuecomment-1569735593
接上面的问题,补全一下调用方的代码和相关环境。
spring-boot:2.7.7
zookeeper:3.5.10
简单的调用方代码,使用Flux.interval定时持续发送消息,代码如下:
```
@Slf4j
@SpringBootApplication
@Service
@EnableDubbo
public class ConsumerApplicationMain {
@DubboReference(proxy = "nativestub", group = "test-sse")
DataModelService dataModelService;
public static void main(String[] args) {
ConfigurableApplicationContext applicationContext = SpringApplication.run(ConsumerApplicationMain.class, args);
ConsumerApplicationMain bean = applicationContext.getBean(ConsumerApplicationMain.class);
//调用方定时持续发送消息
bean.dataModelService.connect(Flux.interval(Duration.ofSeconds(1)).map(num-> {
var builder = Request.newBuilder();
builder.setId(num);
builder.setSessionId("sessionId"+num);
builder.setUserId("userId"+num);
builder.setNs("ns"+num);
builder.setCmd("cmd"+num);
builder.setPayload(ByteString.copyFrom(("payload"+num).getBytes(StandardCharsets.UTF_8)));
builder.setBinary(false);
return builder.build();
}))
.subscribe(System.out::println);
new Scanner(System.in).nextLine();
}
}
```
当提供方和调用方启动成功后,连通正常会收发消息。 此时我停止掉调用方(无论是使用kill还是kill -9 强制杀死),提供方的doFinally方法都收不到流的中断信号,导致我这边无法做资源回收清理动作。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org