java有人能帮我修复这个程序吗:ReqlDriverError:响应泵关闭
我正在学习重新思考DB,我得到了以下错误。我连接数据库,订阅changefeed成功。启动应用程序后,我可以将记录添加到表success中,但15/20分钟后,如果我添加记录,则会出现错误
c.r.g.e.ReqlDriverError: Response pump closed.
at c.r.n.DefaultConnectionFactory$ThreadResponsePump.await(DefaultConnectionFactory.java:214)
at c.r.net.Connection.sendQuery(Connection.java:349)
at c.r.net.Connection.runQuery(Connection.java:384)
at c.r.net.Connection.runAsync(Connection.java:166)
at c.r.net.Connection.run(Connection.java:185).
我的代码如下:
@Override
public void run () {
while (true) {
try {
logger.info ("START RETHINKDB & CHANGEFEED");
conn = r.connection ()
.hostname (configParam.hostRethink)
.port (configParam.portRethink)
.db (configParam.dbRethink)
.user (configParam.userRethink, configParam.passRethink)
.connect ();
// Changefeeds: subscribe to a feed by calling changes on a table
Result <Object> result = r.table ("order")
.filter (
new ReqlFunction1 () {
@Override
public Object apply (ReqlExpr row) {
return row.g ("status"). eq ("APPROVED");
}
}). changes (). optArg ("include_types", true) .run (conn);
for (Object change: result) {
logger.info (change.toString ());
superMarketService.updateApprovedSuperMarketOrder (change);
}
logger.info ("END RETHINKDB & CHANGEFEED SUCCESS");
} catch (Exception e) {
e.printStackTrace ();
}
}
}
public void addOrder (JSONSuperMarket json) {
if (conn == null) {
logger.error ("=============== RETHINK DIE =========");
}
Result <Object> result = r.table ("order"). Insert (r.array (
r.hashMap ("order_code", json.getOrderCode ())
.with ("cash_id", json.getCashId ())
.with ("merchant_id", json.getMerchantId ())
.with ("amount", json.getAmount ())
.with ("status", "PENDING")
.with ("description", json.getDescription ())
.with ("created_date", r.now (). inTimezone ("+ 07:00"). toIso8601 ())
)). run (conn);
logger.info (result.toString ());
}
如果我的代码有任何错误,请帮助我:( 我使用Java8+DB2.4.2
共 (0) 个答案