Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Pushing changes to clients from Java

David_S_deB
Level 1
Level 1
Hi,



I have created a Flex 2 client that polls a webservice every
minute or so which inturn returns data from a DB table (The table
contains data that changes every couple of minutes). This is of
course very DB intensive once you start having multiple clients all
polling at the same time.



I am now looking at doing it in FDS but my problem is how do
I get FDS to update the interal java objects with new data from the
DB (which is updated from an external source)? I read here :




http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Pa...



that using the DataServiceTransaction might be an option.
Perhaps from a seperate java client that some how uses the
DataServiceTransaction class to update the data every 2 minutes of
so? That way pushing any changes that have occured to all the
currently connected Flex clients.



Or am I missing a setting in the FDS that you can set to
refresh the current java objects?



Any help would be greatly appreciated.

3 Replies
pete
Level 3
Level 3
The DataServiceTransaction API is the way to go. Let me ask
if there is a sample of this API handy and I'll get back to
you.
David_S_deB
Level 1
Level 1
Hey Pete.



Any luck finding some example code for this?

jfujita
Level 1
Level 1
Hi, I also have a similar problem with using the
DataServiceTransaction object from an external java program.



I'm using flex and FDS to RTMP push data from a DB server to
clients and I want to trigger data pushing whenever the DB gets
updated by an external java/jdbc program.



The problem is, I can update the DB and call the commit()
function of the DataServiceTransaction object from a
RemoteObject/rpc called by the flex client very much like the
ContactVO.java object on
THIS
page. But I want to develop an external java program that gets
executed separately (Not via RPC) and it will be able to update the
DB and call the DataServiceTransaction.commit() method to push the
updates to the flex clients.



I built a java class to do just that as you can see below:









/**

* ChangeBackEnd.java

*/



package tony.contact;



import flex.data.DataServiceTransaction;





public class ChangeBackEnd

{



public static void main(String[] args)

{



DataServiceTransaction dtx =
DataServiceTransaction.begin(false);



try

{

ContactVO ct = new ContactVO(1, "test", "serverAPI");

dtx.updateItem("tony.dms.contact", ct, null, null);

new ContactDAO().update(ct, ct);

}

finally

{

dtx.commit();

}





}



}





And when I try to run it I get this error.





"Exception in thread "main" java.lang.NoClassDefFoundError:
ChangeBackEnd (wrong

name: tony/contact/ChangeBackEnd)"



Is there any way around this?