有人知道向SMSC提交消息(submit_sm)时如何设置超时吗?我已经尝试将receivetimeout(session.getReceiver()。setReceiveTimeout)设置为6秒,但是大约30秒后我仍然得到空响应。
以下是我设置的超时时间:
当前我正在使用OpenSMPP
TIA:)
答案 0 :(得分:0)
制定新的未来任务
public static class SubmitSMTask implements Callable<SubmitSMResp>{
SubmitSM smRequest;
Session sessionSend;
public SubmitSMTask(Session sessionSend, SubmitSM smRequest) {
this.sessionSend = sessionSend;
this.smRequest = smRequest;
}
@Override
public SubmitSMResp call() throws Exception {
SubmitSMResp response = sessionSend.submit(smRequest);
return response;
}
}
然后调用它。我用100毫秒作为超时时间
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<SubmitSMResp> future = executor.submit(new SubmitSMTask(sessionSend, smRequest));
SubmitSMResp response = future.get(100, TimeUnit.MILLISECONDS);
smsId = response.getMessageId();