Automatic propagation of changed BO values between users

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
verlsnake
Posts: 19
Joined: Thu Sep 04, 2008 7:08 pm
Location: Germany
Contact:

Automatic propagation of changed BO values between users

Post by verlsnake »

The scenario is as follows: Hundreds of users run the same AwareIM 4.0 app in their browsers; data of one and the same business object is accessed concurrently from those different browser sessions; when one user changes BO attribute values and then commits them to the server, how can those changes automatically be propagated to the other users
who share the same data ? Of course users can refresh their data set from time to time; but I'm speaking here of automatic refresh in near realtime ...
Im Himmel gibt's kein Bier, drum trinken wir es hier :-) ...
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Automatic refresh is not supported here. However, if one user changed the data of the business object and then another user changes the same business object without refreshing the data first, Aware IM will issue an error and will not let the second user overwrite the changes (Aware IM automatically maintains version numbers of business objects behind the scene to prevent the overwrites from happenning)
Aware IM Support Team
verlsnake
Posts: 19
Joined: Thu Sep 04, 2008 7:08 pm
Location: Germany
Contact:

Post by verlsnake »

- Only to mention that I try NOT to flood You with questions out of the total blue: I have read about Your business object versioning and conflict resolution strategy in Your docs; I have skimmmed roughly through them ... This kind of conflict strategy is surely adequate for a broad class of (web) apps

- What a pity that changes occurring in the server-side version of a BO are not automatically propagated in realtime to all clients where a BO is currently in use


My question is then: How does the AwareIM rule machinery roughly look like ? I want to understand it in order to be able to evaluate if I can plug AwareIM into a realtime data exchange engine/mechanism; that is if I can use AwareIM to provide the data for a realtime data exchange engine/mechanism
- If a BO is sent to the browser client - using the builtin ExtJS-based UI or using the XML API - then it is NOT touched at all from the server-side automatically; only a client-side refresh can update its data
- The rule-engine updates BO values in realtime on the server-side; but how are BOs exactly handled during a session ? Is there one version residing in memory and one in the chosen persistence engine - if any ? And is the BO version in memory the master that receives changes from the clients and from the server-side rule engine ? And updates the persistence mechanism accordingly ? Or go all client-side saves and server-side rule changes directly to the persistence mechanism and are propagated back to the BO memory version for persistent BOs ? I hope it is possible to grasp what I am trying to find out here ...
- So there must be some kind of master BO representation that is always realtime uptodate on the server-side; is it possible to get access to this master BO representation - perhaps via those communication channels ? For those BOs whose data needs to be exchanged in realtime between clients one could then use a 3rd party realtime data exchange engine and feed it with the BO data; the communication between the BOs and the realtime data exchange engine would have to be bidirectional; that is BOs must be writable from the realtime data exchange engine, too ...


Hopefully my description is not too complicated; I wonder if other AwareIM clients are interested in such realtime data exchange capabilities - cue: Comet -, too ? Perhaps there are already use cases out there which have realized this ?
Im Himmel gibt's kein Bier, drum trinken wir es hier :-) ...
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

I really don't understand why you need to know these details. The phrase "provide the data for a realtime data exchange" sounds too mysterious. I don't think you need to know the inner details of Aware IM workings for any practical purposes. But anyway here goes...
If a BO is sent to the browser client - using the builtin ExtJS-based UI or using the XML API - then it is NOT touched at all from the server-side automatically; only a client-side refresh can update its data
It's using XML API to communicate with the server. Of course, it is not touched by the server automatically. The server only changes the data when there is a request for this from clients. And the client does not have to be a UI client - it can be a service call from a computer, for example. The only time when the server does touch the data without the request from the client is when it is processing periodic scheduling rules
The rule-engine updates BO values in realtime on the server-side; but how are BOs exactly handled during a session ? Is there one version residing in memory and one in the chosen persistence engine - if any ? And is the BO version in memory the master that receives changes from the clients and from the server-side rule engine ? And updates the persistence mechanism accordingly ? Or go all client-side saves and server-side rule changes directly to the persistence mechanism and are propagated back to the BO memory version for persistent BOs ?
If by "session" you mean the time between a user login and logout, then Aware IM does NOT store BO's in memory for sessions and there is no master BO at all. Aware IM DOES store BO's in memory during a "transaction". A transaction is created when the request for data change arrives from the client. A transaction is committed or rolled back at the end of the request. BO"s are read from persistence and cached in memory for optimisation purposes during a transaction.
So there must be some kind of master BO representation that is always realtime uptodate on the server-side; is it possible to get access to this master BO representation - perhaps via those communication channels ? For those BOs whose data needs to be exchanged in realtime between clients one could then use a 3rd party realtime data exchange engine and feed it with the BO data; the communication between the BOs and the realtime data exchange engine would have to be bidirectional; that is BOs must be writable from the realtime data exchange engine, too ...
I have always been mystified by the word "real time". I don't know what people mean by that each time the term is used. As I said there is no master BO in memory except when there is an open transaction. There is no way for a programmer to access this BO directly and interfere in the transactional workings of Aware IM. A programmer needs to operate within a "sandbox" that Aware IM creates specifically for people who want to add extensions to Aware IM programmatically. This "sandbox" is described in details in the "Programmer's Reference Guide".
Aware IM Support Team
verlsnake
Posts: 19
Joined: Thu Sep 04, 2008 7:08 pm
Location: Germany
Contact:

Post by verlsnake »

With 'realtime' data changes I mean data changes which can occur e.g. 10 times per second; or even in the millisecond range ...


For delivering object attribute changes from AwareIM to a realtime data exchange mechanism I can imagine the following:

RULE:
If RealtimeMonitoredObject WAS CHANGED
Then PropagateAttributeChanges NOWAIT

'PropagateAttributeChanges' is a custom process which calls getEntity("RealtimeMonitoredObject", RealtimeMonitoredObject.ID) and feeds the new object values into a realtime data exchange engine


But how could one implement the other way round ? Delivering object attribute changes from a realtime data exchange engine back to AwareIM ?

How can I call the 'updateEntity()' method from a realtime data exchange engine ?
Via an Intelligent BO using the communication channel "Sockets" ?

Before investing more thought into this at all, the following question has to be answered:
Can 'getEntity()' and 'updateEntity() be (mis)used as workhorses for realtime capabilities ? That is could I call them e.g. 10 times per second and the rule engine reacts accordingly ?

If this does not make sense at all: What happens if I access objects created by AwareIM directly in the underlying database ? In order to feed a realtime data exchange engine directly from the database ? Will this disturb AwareIM's rule machinery ?
Im Himmel gibt's kein Bier, drum trinken wir es hier :-) ...
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

How can I call the 'updateEntity()' method from a realtime data exchange engine ?
Via an Intelligent BO using the communication channel "Sockets" ?
What does the realtime data exchange engine do? Is it a third party database that has to be kept in sync with Aware IM? If so, you need to write a custom communication channel - the details are specified in the Programmer's Reference Guide. You obviously need to know the mapping between your engine and instances of BO's in Aware IM. So, you will need to run a query to find the instance of the BO to work with or use getEntity(). If this is too slow and you want to keep the instance in memory during the communication, then you can't do this - you have to update the DB directly using transactions (see below)
Can 'getEntity()' and 'updateEntity() be (mis)used as workhorses for realtime capabilities ? That is could I call them e.g. 10 times per second and the rule engine reacts accordingly ?
Hard to say. These functions are reasonably fast (however, the speed of updateEntity depends on the number of rules that will be executed). You need to run some tests to check this on your system.
What happens if I access objects created by AwareIM directly in the underlying database ? In order to feed a realtime data exchange engine directly from the database ? Will this disturb AwareIM's rule machinery ?
No, it won't disturb it if you do it carefully. Use transactions if you can and make sure that the data you write is consistent (as far as object rules are concerned).
Aware IM Support Team
Post Reply