我们使用Akka框架进行进程间通信。几天前,QA团队发现了一些被困在困境中的请求。对于某些请求,没有调用onSuccess()和onFailure()回调方法。最后一行日志显示
"Charging Customer."这个特定事务的流程就在那里停止了。下一个日志应该是
"Charging response or Charging Failed"这种行为的原因是什么?是不是因为调度员窒息了?我们使用的是默认的调度程序。
码
log.debug("Charging Customer");
Future future = Patterns.ask(actorSelection, new Gson().toJson(request), timeout);
future.onSuccess(new onChargingSuccess<>(ccRequest), context().system().dispatcher());
future.onFailure(new onFailureHandler(ccRequest), context().system().dispatcher());
private class onChargingSuccess<T> extends OnSuccess<T> {
@Override
public void onSuccess(T t) throws Throwable {
log.debug("Charging response:" + t.toString());
}
private class onFailureHandler extends OnFailure {
@Override
public void onFailure(Throwable thrwbl) throws Throwable {
log.info("Charging Failed");
}发布于 2017-02-14 06:36:33
这并不是真正的解决方案,但是重新启动模块解决了问题。这个模块运行了一年。我知道这使它成为一个非常普遍的问题,但我将把它留在这里,以防我们深入研究实际问题并找到解决办法。那样的话我会更新的。
https://stackoverflow.com/questions/42198218
复制相似问题