Writing the Notification Services
Notification services alert Mobile Support when the backend application updates the backend data directly, outside of Mobile Support.
Note:
When the backend data is updated by both the backend application and a mobile application that submits synchronization requests to
Mobile Support,
Software AG recommends configuring mobile sync components created for your synchronization solution to store business data in the sync store. Doing so helps ensure that
Mobile Support can correctly detect and resolve conflicts. For instructions, see
Step 2: Create a Mobile Sync
Component.
Mobile Support determines whether a synchronization request comes from a mobile application or from a backend notification service based on the set of parameters provided in the synchronization request message. When the request header contains a mobile application name and a mobile application version, this indicates that the request is from a mobile application. If this information is not present, Mobile Support identifies the request as coming from a notification service.
To write a notification service
1. Create an adapter notification to contain information about an event that occurs on an adapter resource, and to send the notification data to Integration Server in the form of a published document.
Configure notifications so that they are received in the order in which data changes occur. If you are using webMethods Adapter for JDBC, for example, you can specify an “ordered notification” type for this purpose.
Note:
If you are using a polling adapter, keep in mind when setting the polling interval that the potential exists for a subsequent backend data update to occur before Mobile Support receives the notification about a previous update. Set the interval based on the expected frequency of backend data updates made directly by the backend application and the conflict resolution rule in place for the mobile application.
2. Create the trigger service that processes the published document. In a mobile data synchronization scenario, the published document contains the changed backend data that Mobile Support should use to update the sync store. When creating this service, keep the following points in mind:
Include branching logic to identify the operation executed (update, insert, or delete).
Invoke the
wm.mobile.datasync:synchronize service to update the
Mobile Support sync store with the changes made in the backend data. Pass the input payload as defined in the service’s input signature.
Create a messaging trigger to subscribe to the document type created for the notification and invoke a trigger service to process a published document when one is received.
For more information about creating adapter notifications, messaging triggers, and trigger services, see webMethods Service Development Help and the adapter documentation for the adapter you are using.