Introduction
The web services allow users to create and manipulate the data record(s) of Exact Synergy Enterprise via a third party application. This technology enables the software developers to connect systems with less programming and thus, simplifying the integration of multiple systems, which reduces the repetitive data entry and updating process.
The web services allow the third party application to retrieve and manipulate data in Exact Synergy Enterprise and update the data in the third party applications if changes were made to the Exact Synergy Enterprise data using the notification solution.
Description
The objective of notification solution is to react to the changes in the entity component of Exact Synergy Enterprise (which is identified as the "publisher") and publishes the changes as a notification to the third party applications which are identified as the "subscribers". For example, with the notification solution, when an item is created in Exact Synergy Enterprise, a notification will be sent to the subscriber to create the item in the third party application automatically. This ensures the data in the third party application is updated instantly and synchronized with the data of Exact Synergy Enterprise for the business entities that are enabled for web services.
The following are required to enable the notification solution:
- Activate the notification service
- Develop a program, which is identified as the "provider", that will process the data received from the publisher meant for the subscriber.
- Subscribe to the notification service
In summary, the "publisher" publishes the changes as a notification. The notification is received by the "provider" which processes the notification for the "subscriber".
To activate a notification service
The notification service can be activated by configuring it via a configuration file, with the file name “Exact.Notification.config” in the "xmd" subdirectory of the Exact Synergy Enterprise installation directory. The configuration file has two sections; publishers and subscribers. The notification component is dependent on the configuration file to get the available subscriptions to entities and also update subscribers based on the available subscribers in the list.
Publisher
The "Publisher" is the one who publishes available topics including topic events. In the connectivity solution, entity component is used as a "publisher".
For example:
Topic: Account
Topic Events: Create, Update, Delete.
This means that the events Create, Update, and Delete on the topic Account will trigger a notification to "subscribers" (only if there is any "subscriber" for this topic) through notification component.
The following is the example of the XML format of the publisher in the configuration file for topics Account, Item, and Resource.
The publisher can be configured based on the requirements. If you would like to add a new topic to be published, you can configure it by adding the XML tag under <Publishers>. Assuming that you would like to publish two new topics: Document and Request, with the topic events Create, Update, and Delete, the example is displayed in the following screen:
By default, the topics Account, Item, Resource, Document, Request, and Project with topic events Create, Update, and Delete are published.
Notification message handler
By referring to the XML file above, you must specify a messagehandler to each of the topic in the publisher. Currently, a standard message handler "MessageHandler.ER.ESE" is used to perform the filtering. You can specify the property you want to send via the notification services as defined in the "subscriber".
To create a provider program for the subscriber
A "provider" is a program that you develop to process the notification received from the "publisher" for the "subscriber". You may instruct the program to update the data, send an e-mail or SMS, or perform other actions as required.
To create a provider, create a class that inherits from BSubscriber base class, Exact.Services.NotificationModel.BSubscriber (Of String, String) and the program which will override the base method from the base class. The notification is passed via the Message parameter and if an error is encountered, it can be captured via the ErrorMesssage parameter. The notification consists of the data changed based on the topic events and the topic in an XML format. Inside the Action method, it could be any process handling the notification at the receiver end such as storing the data into database, implementing Microsoft Message Queuing system (MSMQ) to manage the notification or others.
The following is an example of a simple provider (Text class) that writes the notification received into a text file and stores it into a physical file in the hard disk. The method will return "False" if an error is encountered. The derived class can be residing in any assembly as long as it is configured in the configuration file by providing the fully qualified class name and the assembly as shown in the following section.
However, you might need to manipulate with the message class to override the existing base Onupdate method. For example, use "Public Overrides Function OnUpdate (ByVal message As Data.NotificationMessage(Of String, String)) As Data.ReplyMessage" instead of Action from the base class.
To subscribe to a notification service
The "subscriber" is required to subscribe to the notification services in order to process the notification that is published by the publisher.
Subscriber
The "subscriber" is the one who is interested in the published topic events. The subscriber section of “Exact.Notification.config” is used to configure the topic and topic events that are subscribed by subscribers. It will be using the provider model where each topic can be subscribed by multiple subscribers. It is configured based on subscriptions. The same topic can be subscribed by more than one subscriber.
For example:
Topic: Account
Topic Events: Create, Update, Delete (Topic events here should be a subset of topic events available from the publisher).
Provider: Exact.Services.NotificationModel.Subscribers.Twitter, where the notification will be received by Twitter.
This means that when there are events Create, Update, or Delete happening on the topic Account, it will receive a notification from the publisher through the notification component.
Below is the XML format of the "subscribers" in the configuration file for Account, Item, and Resource. Three of them are using Twitter as the provider.
The subscriber can be configured based on the subscriptions. If you want to subscribe to a new topic, you can configure it by adding the XML tag under <Subscribers>. Assuming we would like to subscribe to two new topics: Document and Request, with the topic events create, update and delete, using the provider “Exact.Services.NotificationModel.Subscribers.Text”, the example is displayed in the following screen:
You can specify the properties which you want to receive in your "subscriber".
Below is an example of notification message structure in XML formate for the resource entity:
Entity data consists of entity name and properties, where properties consists of a collection of property data with name, value, and no rights property.