ModificationSyncServiceis a REST service that can be used to synchronize the access to shared resources from multiple applications. Such resources may be a central database or interfaces to external systems, for example. Applications can request a lock to a certain resource and if the resource is not locked already the request will be granted and recorded. Otherwise the application will be notified that a lock exists so that it can react accordingly, e.g. by notifying the user or postpone the processing of the resource. The business framework of SDACK can use a sync service to synchronize requests to persistent entities in a database.
ModificationSyncEndpointthat provides a simple
Endpointinterface to sync services. For the administration of running sync services the command line tool
ModificationSyncServiceToolcan be used.
/api/sync/under which the actual synchronization API is available to applications. There are also some additional URLs that can be accessed:
/info: displays some basic informations about the service (this is also the default if the service address is invoked without a URL
/healthcheck: both return true if the service is up and running. Can be used for monitoring purposes
/api/statusprovides serveral endpoints to query the service status:
/api/status/uptime: the uptime of the service in milliseconds
/api/status/start_date: the start date and time of the service in the standard ISO date-time format
/api/status/current_locks: the currently held locks, mirrored from the sync API
/api/controlallows to query and modify the service:
/api/control/runalways returns true; settings this to false will terminate the service immediately
/api/control/log_levelreturns the log level of the service; it can set set to either
TRACE, DEBUG, INFO, WARN, ERROR,or
FATALto set the logging level of the service
/api/syncprovides the following endpoints:
/api/sync/check_lock: check whether a certain lock already exists
/api/sync/request_lock: register a new lock for the current client if it not already exists
/api/sync/release_lock: release a lock held by the current client
/api/sync/current_locks: list the locks currently held by the service (mirrored as
/webapiwhich provides a simple HTML view of the service API. This provides a way to quickly check the service status from a web browser. Service modifications are not possible through the web service. For that purpose the ModificationSyncServiceTool (or the regular JSON API) should be used.
Endpointclass that provides an easy way to communicate with a running ModificationSyncService. Examples for using this endpoint can be found in the ModificationSyncServiceTool.
java -jar mss.jar
java -jar mss.jar -url http://sync-service.example.com -list
-listwill list all locks in the sync service, grouped by contexts. This is the same data that will be displayed when navigating to the
/api/status/current_locksURL of the service. If a context is provided with the
-context <context>switch a command will only be applied to that context. The list command would then only list the locks in the given context.
-unlockcommands. These set or remove locks for the respective target IDs in a certain context. The
-resetcommand will clear all locks in given context or, if omitted, in all contexts. These lock-modifying operations should be handled with caution as they can severely affect the lock synchronization in an infrastructure. The ModificationSyncServiceTool is an administration tool that is only intended to solve problems that occur because application perform erroneous lock handling.
-loglevelwhich sets the log-level of the sync service at runtime as described for the
/api/control/log_levelURL. Caution is advised for the TRACE and DEBUG log levels as they may cause the output of much data in short time, possibly filling available storage space of the sync service.