Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Pushing changes to clients from Java

Avatar

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

Avatar

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.

Avatar

Level 1
Hey Pete.



Any luck finding some example code for this?

Avatar

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?