On 03/09/13 00:28 -0700, Kaushik S wrote: > > > On Tuesday, September 3, 2013 12:13:28 PM UTC+5:30, Cédric Krier wrote: > > > > Still not enough information to answer. > > What is it stored in this DB? Why do you need to know new entries? What > > do you really need to do when new entries appear? Is there never deleted > > entries? > > Also you say it happens 1 or 2 times per month and you want to check it > > every minutes. Why do you need to spend soo much ressource for that? > > > > > This is for GNU Health, hospital management. The database table has a list > of people with their address and phone numbers. This is a privileged list. > These are people who would have 'some' free access to the hospital. The > hospital has its own database of all the patients. Some of these patients > will be from the privileged list. Sometimes existing patients might go on > the privileged list. Whenever a new entry has been added to the > privileged list or an existing patient goes on the privileged list, we need > to update our records so that billing etc happens correctly. I do not > wish to spend so much resource checking every 1 or 2 minutes. But, I > wouldn't want any human intervention and it should all happen > automatically. *I am open to any suggestion that is a Tryton way of doing > this. It doesn't have to be cron. * > > There is a delete in the privileged list but it happens very very rarely. > When a delete happens, there is a delete flag that is turned on. You are > right, there is indeed the delete case. > > *Perhaps the ideal way to do this is to have an external daemon that > maintains a connection to the database and constantly polls looking for > additions and deletions. * > > *Alternatively, we could just decide to do this manually. This possibility > is not ruled out. * > > However, purely from the technical point of view I would like to know the > options available and how you would do this. Is this is a rare scenario for > ERP where you have to constantly poll for changes in an external database? > If that is so, please let us know. I have not worked with ERP before.
Polling shoud always be the last solution. From your example, I think I will write a Function field on the patient that will read the value in the other DB. I guess the cost of such read on the fly is not too high. -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpAOTUwDQ_3o.pgp
Description: PGP signature
