Alternatives to Realm Functions

ros

#1

In order to realize the same function as Ream Functions, is the concept of implementing with Data Adapter API correct?


#2

@tkymgr That is correct OR you can use the Global Notifier which is a more coarse grained API and easier to set-up at first:
https://docs.realm.io/platform/using-synced-realms/server-side-usage/data-change-events


#3

Thanks for your help!

Initially, I implemented it using global notification, but deleting the db file with realm studio, after a while, the db file was restored in some cases. So I thought of a way to use the data adapter API.
However, the result is similarly the db file has been restored. This is because I noticed that the access history of the db file remained as a file inside the program using the adapter API, so stop the program with shell script, delete the db file with the REST API , The problem is solved by starting the program after deleting the db file inside the program.
Is there a smarter way?

my script is

#!/bin/bash

USERID=$(curl -X POST https://example.com/graphql/%2f__admin \
  -H 'Authorization: ADMIN_TOKEN' \
  -H "Content-Type: application/json" \
  -H "cache-control: no-cache" \
  -d '{"query": "{users(query: \"accounts.providerId='\'''${1}''\''\") {userId}}"}' 2>/dev/null | jq -r '.data.users[].userId')

/bin/supervisorctl stop all 2> /dev/null

rm -rf /home/expamle/adapter/realms/${USERID} 2> /dev/null

curl -X DELETE --header 'Authorization: ADMIN_TOKEN' https://example.com/realms/files/%2F${USERID}%2Fdbfile

/bin/supervisorctl start all 2> /dev/null

Thanks


#4

@tkymgr Why do you need to delete the realm? Yes that is true the Adapter and Global Notifier are built off the Realm SDKs so they act like just another client and react to data being synced from ROS


#5

We use the DataAdapter or Global Notification feature to synchronize with MySQL at business transaction level (ordering, sales etc.).
We have created Realm Datafile for each customer, and we have deleted Datafile when the contract with the customer expires.
Therefore, this problem is occurring.


#6

@tkymgr Do you delete the Realm on ROS as well?