To connect to Data Management Service using the <mx:DataService> tag, you must configure a destination in your service-config.xml file. The section describes how to configure the destinations and data adapters they use, and also how to push data to clients.
Data Management Service Destination Configuration
As mentioned previously, messages are transported over message channels. You can define one or more message channels for a destination definition. If one channel cannot be reached, the next one in the list is tried.
The following example shows a destination definition with two message channels defined:
<service id=”myDataManagementService” class=”flex.data.DataService” messageTypes=
“flex.data.messages.DataMessage”> <adapters>
<adapter-definition id=”actionscript”
class=”flex.data.adapters.ASObjectAdapter” default=”true”/>
<adapter-definition id=”java-adapter”
class=”flex.data.adapters.JavaAdapter”/>
</adapters> <default-channels>
<channel ref=”my-rtmp”/>
</default-channels> <destination id=”contact”>
<adapter ref=”java-adapter” />
<properties> <source>dev.contacts.ContactAssembler</source>
<scope>application</scope>
<cache-items>true</cache-items> <metadata>
<identity property=”contactId”/>
</metadata> <network> <session-ti
meout>20</session-timeout> <paging enabled=”t
rue” pageSize=”10″ />
<throttle-inbound policy=”ERROR”
max-frequency=”500″/>
<throttle-outbound policy=”REPLACE” max-frequency=”500″/>
</network> <server>
<fill-method> <name>loadContacts</name>
</fill-method>
<fill-method> <name>loadContacts</name>
<params>java.lang.String</params>
</fill-method> <sync-method>
<name>syncContacts</name>
</sync-method> </server> </properties>
</destination>
</service>
Configure Network-Related Properties
The network-related properties are the same as configuring the Flex Message Service, except that there are two additional properties, cluster and paging, as shown in the following table.
Transactions
All client changes are handled as one unit and, if the value cannot be changed, all changes are rolled back. Your J2EE server must support J2EE transactions (JTA) for distributed transactions to work.
The following defines the use of transactions within a destination definition:
<destination id=”myDestination”> <properties>
<metadata>
<identity property=”name”/>
</metadata> </properties>
</destination>
Item Caching
The default setting in Data Management Service is set to true for items returned from fill() and getitem() calls. This means a complete copy of the managed state of all active clients is kept in each server’s memory.
The following example turns off the cache of items in the destination definition:
<destination id=”myDestination”>
<properties>
<cache-items>false</cache-items>
</properties>
</destination>