on 2024 Sep 30 3:36 PM
Hi experts,
i'm currently using the v24.8.0 of SAP BTP SDK for Android with with offline odata
But I can't figure it out how to batch my CUD operations. In the last versions of the SDK, I was using the class OfflineODataRequestOptions and his TransactionId to group them. But now, it doesn't seem to work.
Is someone knows how to handle this situation ?
Thanks a lot
Yohann
OData #offline odata
Request clarification before answering.
Hi @yohann_weberfr,
The SAP BTP SDK for Android provides specific classes for submitting batch requests to the backend. Check out following guide: https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/features/backen...
Best regards,
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Robin,
I have implemented your solution. I worked with plenty of SDK version, and it's the first time I have to do it. I don't know why. (I'm working with the offline odata)
Anyway, I'm still facing an issue. When the user confirm an action, for example, i create a batchRequest and changeSet and put all the modifcations in it and i call the data sync just after that. It works if the sync is ok
val batchRequest = RequestBatch().
val changeSet = ChangeSet()
//update device in changeset
changeSet.updateEntity(
updatedDeviceEntity,
HttpHeaders.empty,
OfflineWorkerUtil.defautlRequestOptions
)
//update register's device in changeset
updatedRegistersList.forEach { updatedRegister ->
changeSet.updateEntity(
updatedRegister,
HttpHeaders.empty,
OfflineWorkerUtil.defautlRequestOptions
)
}
//update MRU in changeset
updatedMRU?.let { updateMRU ->
changeSet.updateEntity(
updateMRU,
HttpHeaders.empty,
OfflineWorkerUtil.defautlRequestOptions
)
}
batchRequest.addChanges(changeSet)
api.processBatch(batchRequest)
But in the case, i haven't connectivity (i'm using offline odata), the second times, the same code is executed. (I also create a batchrequest and a changeSet). When, the sync is done, i only see 1 batch with only the first object in it.
I can see in the offline provider, all the request queued. But, only the first is send to the backend.
edit:
I've just tried the direct update call (without batch syntax) and I see the atomic update request a arriving in the backend system :
//update device in changeset
api.updateEntity(
updatedDeviceEntity,
HttpHeaders.empty,
OfflineWorkerUtil.defautlRequestOptions
)
//update register's device in changeset
updatedRegistersList.forEach { updatedRegister ->
api.updateEntity(
updatedRegister,
HttpHeaders.empty,
OfflineWorkerUtil.defautlRequestOptions
)
}
//update MRU in changeset
updatedMRU?.let { updateMRU ->
api.updateEntity(
updateMRU,
HttpHeaders.empty,
OfflineWorkerUtil.defautlRequestOptions
)
}
When I monitor the requests queue list with the 2 methods, they are equals :
api.getQueuedRequests().forEachIndexed() { index, request ->
LOGGER.debug("Request $index: ${request.toStringWithDetails(true)}")
}
Is someone have a clue on this behavior ? Is it an issue/bug ?
Thanks
Yohann
User | Count |
---|---|
31 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.