Calculation Service

From SMath Wiki
Jump to navigation Jump to search

Introduction

Calculation Service is a process that can be started by the external application to immediately perform calculations via SMath Studio. It is important to understand that Calculation Service is not registered in the operating system as a service, and its full lifecycle completely depends on the calling application. Calculation Service is delivered as a separate executable module, available in the main SMath Studio Enterprise folder:

 SMath.UI.Service.exe

List of commands, supported by the current version may be taken by standard -? or -help command call:

 SMath.UI.Service.exe -help

Limited Access

Calculation Service is an optional component of SMath infrastructure available only with a proper licensed SMath Studio Enterprise installation for our commercial customers.

Calculation Service API

To ensure maximum ease of interaction with Calculation Service for third-party developers, along with SMath Studio Enterprise a convenient API is supplied in the form of a file in the program installation directory:

 SMath.UI.Service.Api.dll

When running on Windows, the Calculation Service API library is registered to interact with COM on SMath Studio Enterprise installation, which makes it possible to implement integration with SMath Studio Enterprise to almost any external application.

Calculation Service API Lifecycle

Working with Calculation Service is performed as follows:

  1. Start Calculation Service. Optionally it is possible to specify the port to use or it will be allocated dynamically otherwise. API may be used to get an allocated port then.
    Started Calculation Service loads the application components. It may take a few seconds, depending on your hardware and installed add-ons amount in SMath Studio Plugins.
    Calculation Service may be started manually in a command line, or you may initiate new service instance via API call.
  2. Request connection to the service started in the previous item. You will need a port to be used.
  3. Prepare .sm file to calculate and format input data.
    Initially the service was created for internal use and it caused using internal XML based format. In order to simplify input/output data handling special plugin type was introduced.
  4. Request to calculate .sm file(s) indicating initial data and returning calculation results format.
    Calculation occurs as quickly as possible, because application components are already loaded in memory and ready to make requests.
  5. Close connection(s) to the service and terminate the Calculation Service process.
    After Calculation Service process is completed, its process is unloaded from memory and no longer available for any external applications interaction.

Examples

In order to simplify developer's introduction into how to work with Calculation Service several examples have been developed and made available in our public sources repository under https://smath.com/svn/public/integration

At the moment .NET based and Delphi based examples are available. More environments will be covered later.