setOnDataSync

abstract fun setOnDataSync(onDataSyncHandler: OnDataSyncHandler?)

Sets the handler for incoming DataSync realtime events. This method allows the assignment of an OnDataSyncHandler implementation or lambda expression to handle incoming DataSync create/update/delete events.

A single subscribed ref-channel delivers a mix of DataSync leaf types, so branch on the sealed PNDataSyncEventResult.getExtractedMessage().

To deactivate the current behavior, simply set this property to null.

Note that this property allows for the assignment of a singular behavior at a time, as any new assignment will override the previous one. For scenarios requiring multiple behaviors in response to DataSync events, it is advisable to utilize EventEmitter.addListener.

Setting a Behavior Example:

`setOnDataSync(pnDataSyncEventResult -> System.out.println("Received: " +  pnDataSyncEventResult.getExtractedMessage()));
`
*

Removing a Behavior Example:

`setOnDataSync(null);
`
*

Parameters

onDataSyncHandler

An implementation of OnDataSyncHandler or a lambda expression to handle incoming DataSync events. It can be null to remove the current handler.