Rhoconnect synchronization data sotre


Hello,

We're following Rhoconnect synchronization example, storemanager and storeserver, and we have a question about data store.

When we create an item and then we call “sync” function we see that it goes to Rhoconnect and it calls to query() and create() function. That’s right. But if we don’t return anything, query() function will remove all terminal items.

At terminal, we have a database with one new item and we want to synchronize with Rhoconnect in order to tell to other terminals that there is a new item. That’s all.

Must we store all items at rhoconnect (using a database or a text file) and then when we execute a query() function Rhoconnect will do a select to this?

In your example, you use @base variable at initialize function,

@base = 'http://rhostore.heroku.com/products'

And then, at create function you do it. But we don't understand exactly what are you doing...

rest_result = RestClient.get("#{@base}.json").body

Could you help us?

Thanks.

Divyansh Madan
What we are doing is that

What we are doing is that using JSON through which we are accessing the link provided under "@base" and through restclient we are getting the data from the link provided.

I hope this helps.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Oesia Project
OK thanks. So we need to

OK thanks.

So we need to create a database or something similar at Rhoconnect to save our data, don't we? And we must store all items at rhoconnect (using a database or a text file) and then when we execute a query() function we have to execute a select and return all items?

Is this the way to work with Rhoconnect and our Terminal?

Thanks!

Jordi.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Divyansh Madan
YesIf you need to sync with

Yes

If you need to sync with your data using Rhoconnect ,You need to create your own database(could be in SQL) and access that through Apache server,so that you can mention that link instead of the heroku link provided.

Hope this helps.

Thanks

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Glenn Sayer
Not sure is this answers your

Not sure is this answers your question or not.  When doing a sync you need to add the "sync_changes => true" in your app>settings>controller.rd in the dosync  call in the do_sync section.  This will cause the new items to be written before the query is done.

SyncEngine.dosync(false,":search_params => {upc = @params['22']},:sync_changes => true")

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Hamid Seleman
Hello,rest_result =

Hello,

rest_result = RestClient.get("#{@base}.json").body


1. I think, what the above code does is making a synchronous http GET call to url "http://rhostore.heroku.com/products.json" and

extract the body of the response in which where the result in json string is and assigned them to rest_result variable.

If you paste, "http://rhostore.heroku.com/products.json" onto your browser, you'll get a json formatted result of all existing products.

2. As I understand it, We need not to worry how RhoConnect app's redis store caches your data, it is managed by RhoConnect Syncronization service to keep your data synced between your back-end app and your rhodes app data. The RhoConnect by default is polling at 300 seconds interval (stated in settings.yml for each source adapter) your backed app for latest changes, fetches changes and apply them to the redis store. RhoConnect does not push any notification of changes to your rhodes app. Instead, your rhodes app should perform polling by calling SyncEngine.doSync. By default, RhoConnect Client in your rhodes app is polling the RhoConnect App at 5 minutes interval for any changes. You may programmatically change it by calling the following method:

SyncEngine.set_pollinterval(0) # set to zero to disable polling or your desired interval in seconds

alternatively this can be set in the rhodes runtime config (rhoconfig.txt) by adding the following:

sync_poll_interval=0

Make sure you enable your models for sync and set the Sync Server address in rhoconfig.txt

my 2 cents, I hope that helps.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments