Skip to content

Add a SyncJobStatus result callback amid Sync retries #2049

Closed
opensrp/android-fhir
#15
@ndegwamartin

Description

@ndegwamartin

Is your feature request related to a problem? Please describe.
Currently, there is no way for reliant apps to obtain the exceptions from backend calls until all Sync retries are completed by the FhirSyncWorker class. Our app would like to process the exceptions as soon as they happen.

Describe the solution you'd like
We'd like to add an abstract method to the FhirSyncWorker.kt class that would need to be implemented by the reliant app. It should accept a parameter of type SyncJobStatus.

For example:

abstract fun onSyncJobResult(syncJobStatus: SyncJobStatus)

It should then be invoked within the FhirSyncWorker.doWork method after the result is obtained.

Describe alternatives you've considered
We could also just log the failures in an open method that could be overridden by the reliant app. This way they'd have the ability to obtain the exceptions that are part of the SyncJobStatus.Failed instance. The SDK could log those errors in its implementation(as default).

For example:

open fun onFailedSyncJobResult(failedSyncJobStatus: SyncJobStatus.Failed){
     Timber.e(failedSyncJobStatus.exceptions);
}

Additional context
N/A

Would you like to work on the issue?
Yes

Metadata

Metadata

Labels

P1High priority issue

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions