SyncBroadcaster

class SyncBroadcaster @Inject constructor(val configurationRegistry: ConfigurationRegistry, val fhirEngine: FhirEngine, val syncListenerManager: SyncListenerManager, val dispatcherProvider: DispatcherProvider, val workManager: WorkManager, val context: Context)

This class is used to trigger one time and periodic syncs. A new instance of this class is created each time because a new instance of ResourceParamsBasedDownloadWorkManager is needed everytime sync is triggered; this class SHOULD NOT be provided as a singleton. The SyncJobStatus events are sent to the registered OnSyncListener maintained by the SyncListenerManager

Constructors

Link copied to clipboard
@Inject
constructor(configurationRegistry: ConfigurationRegistry, fhirEngine: FhirEngine, syncListenerManager: SyncListenerManager, dispatcherProvider: DispatcherProvider, workManager: WorkManager, context: Context)

Properties

Link copied to clipboard
Link copied to clipboard
val fhirEngine: FhirEngine
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun runOneTimeSync()

Run one time sync. The SyncJobStatus will be broadcast to all the registered OnSyncListener 's

Link copied to clipboard
suspend fun schedulePeriodicSync(interval: Long = 15)

Schedule periodic sync periodically as defined in the application config interval. The SyncJobStatus will be broadcast to all the registered OnSyncListener's