This content has been marked as final. Show 6 replies
>>There are several other CFC's and other apps that modify the underlying database and i want those updates pushed out to the subscribers of the data. How can i accomlish this?
You should be able to use the CF adapter to reuse those CFCs.
>>From what i have seen so far the only way the contact sample can push the updated data, is by updating the data through FDS. is this correct?
Hi and thank you for the reply.
Can you give me some detail on using the "CF Adapter to reuse those CFC's" ?
Is there a function i can call after my other CFC's modify the data?
like: <cfquery...> update table...</cfquery> somefunction.update()??
Or is there some sort of data watcher event gateway that can watch for database changes and push out / sync with the FDS subscribers?
I have read through all the articles, but i can not find an answer to this.
How can i publish data changes without using a Flex front end?
In other words, I have many existing CFC's that update and insert data.
I need a way for those CFC's to update the ArrayCollection in the FDS..
Lets say i have a DAO that watches my users table.
It displays all changes to the users data when changed in the Flex app.
But when a user logs into the entire applicaiton (CF & Flex) some updates are done on that users record in the users table.
The updates are done via a CFC.
I need the update function to instead update the data through the DAO CFC, which i have working now. but since it is calling it directly and not through the Assembler which contains the functions that update the Flex ArrayCollection (I think)..
SO can someone give me some documentation on the Change Object that is used in the "sync" function of the CFC's that are generated with Flex Builder 2?
Or tell me how i can create a changeObject myself and pass it to the sync() function????
I found a solution. but i am not sure this is the correct way to handle this.
First let me explain exactly what i am attempting and what i am working with and what i did to somewhat fix the issue i was having.
Ok, i have modified the contacts sample app to read from my data source and display the data in a single grid.
I used FB to create the CFC's for the DAO.
I updated all the code to work with my model.
So i have a single datagrid and thats it for display from the contacts sample.
I used all the same as functions and renamed them accordingly as well as the contact.as file.
Now in CF, i again used the DAO that was created for me.
Now i have a working project with my test data.
The problem i ran into was getting updates into my flex project.
After the suggestion in this post, i went back to another sample i modified to work for my environment the SessionTracker.
It uses a CF Event gateway to publish changes to consumers.
I made a new GateWay instance in CF Admin, i added a new destination in the messaging-config.xml, i made a new CFC for the GateWay from the basic example in the docs:
<cfcomponent displayname="sendUpdates" hint="echo messages from the event gateway">
<cffunction name="onIncomingMessage" output="no">
<cfargument name="CFEvent" type="struct" required="yes">
<!--- Create a return structure that contains the message. --->
<cfset retValue = structNew()>
<cfset retValue.DestinationID = arguments.CFEvent.OriginatorID>
<cfset retValue.MESSAGE = arguments.CFEvent.Data.MESSAGE>
<!--- Send the return message back. --->
Then in my Flex app, i added the consumer exactly how it is in the sessionTracker but with my new Destination.
And a eventListener to refresh the fill.
In my original CFC's that update the database, i simply do the following:
<!--- Build body structure --->
<cfset msg.body.sendUpdate = true>
<cfset SendGatewayMessage("Flex2CF", msg)>
<cfcatch type="any" />