使用JCo(3.x)讀取SAP服務器發送的IDOC時,應該採取什麼操作來指示消息已被正確接收(即提交) ?如何在讀取IDOC時控制事務(提交/回滾)
在Java中我想是這樣的:
public class MyHandler implements JCoIDocHandler {
public void handleRequest(JCoServerContext serverCtx, IDocDocumentList documentList) {
IDocDocumentIterator iterator = documentList.iterator();
while (iterator.hasNext()) {
IDocDocument doc = iterator.next();
// some processing
}
// here I would like to say COMMIT
// i.e., I confirm all the documents have been read
// and our side takes ownership
}
}
這種類型的承諾似乎有必要,如果我們要確保沒有消息(IDOC)丟失,即使子彈擊中一些.hasNext()
在通話過程中CPU。或者我錯了?