We are working on improving the ability to do these types of
"master/detail" relationships in future LC DS versions with a single
destination.   Using one destination is obviously how you'd like to do
it but you do run into some performance problems for large collections
and object graphs with how it is implemented today.   In the future
we'll have additional metadata to specify on association properties (at
least) which let you specify one or more properties are unfetched until
the client tries to access them.  

 

I take it you are turning off auto-sync so you can use the "paged fill"
stuff -i.e. the fill methods which return a page at a time?   (We hope
to also remove that limitation in the next release as well).

 

The simple answer for keeping data between two destinations in sync is
that in your assembler's updateItem method for one destination you use
the DataServiceTransaction.updateItem method for the other destination
(or similarly for createItem and deleteItem)

 

But when auto-sync is turned off, clients using that destination won't
receive those pushed changes.   You can however use manual
synchronization.   Clients can subscribe to one or more subtopics or use
a selector expression which specifies which messages they want to
receive.  Clients or server code which publishes changes can specify
which subtopics those messages go to.  

 

Here's a snippet which shows you subscribe manually for a destination:

 

                personService.manualSync.producerDefaultHeaders =
{a:"4"};     // used for selector expressions

 
personService.manualSync.producerSubtopics.addItem("grouptopic");

 
personService.manualSync.consumerAddSubscription("grouptopic", "a IN
('3', '4', '5')");   // subscribes both to a subtopic with a selector
expression

                personService.manualSync.consumerSubscribe();

 

The DataServiceTransaction class also has the ability to set headers and
subtopics which its changes are published to.

 

Jeff

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of gabrysb
Sent: Friday, December 07, 2007 6:18 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] DS - Data synchronization between 2 destinations?

 

Hello,

I run into a problem. I'm using LC Data Services with two destinations:
"Customers" and "Customer". First one is used to fill datagrid with
basic customer information like "name, city", the second one to
get/update/create specific customer. I decided to split this into two
destinations because there are 30,000 or more customers so destination
"Customers" uses custom paging (with startIndex, number of rows) and
there are many more properties of each customer than "name, city".

So, when user double clicks in the data grid form displays and
destination "Customer" getItem is called to fetch full information
about this specific customer.

So far so good. It works flawlessly. BUT! because i'm using paging to
fill datagrid i disabled caching and autoSync:
<cache-items>false</cache-items>
<auto-sync-enabled>false</auto-sync-enabled>
in "Customers" destination configuration.

How can i make destination that fill datagrid aware of changes made
through other one? I thought about using subtopics, but as far as I
know theses are destination specific so no joy.

Maybe I should do all of this using only one destination? but what
about getItem in assembler? I cannot use it once to get full customer
data and the other time to upadte specific row in datagrid (getItem
would be used to refresh particular row in case of update, wouldn't it?)

Im using plain java for assemblers, services (no hibernate, etc.). 

I'm looking forward for any suggestions, it is quite possible I'm
making a big conceptional mistake because i just started using DS (and
i find it amazing).

Thanks,
Gabriel Borkowski

 

Reply via email to