Space Middleware (Magic xpa 3.x)

« Go Back


Created ByKnowledge Migration User
Approval Process StatusPublished

Space Middleware (Magic xpa 3.x)

In addition to the Magic Request Broker, Magic xpa 3.x supports an In-Memory Data Grid (IMDG) as its underlying messaging layer. GigaSpaces’ XAP in-memory computing technology is the middleware that implements Magic xpa’s functionality on the In Memory Data Grid.


  • The Studio cannot use the Space middleware (although it can connect to a space for the Space database).

  • The Runtime engine cannot be started in Online mode when using the Space middleware.

GigaSpaces folders

The Magic xpa root folder contains two subfolders for GigaSpaces:

  1. GigaSpaces – Contains GigaSpaces-xap's required files including:

  2. GigaSpaces-xpa – Contains startup and customized files to launch the Magic xpa space.

    This folder contains the following subfolders:

    a. Bin folder – Contains batch files to manually manipulate the space. Among the files in this folder are:

  • setenv.bat – Defines the environment settings for the space. The properties in the file include:

Magic xpa settings:

    • -Dcom.magicsoftware.xpa.DefaultApplicationAndProgramNames= This is used to define the default application and/or program names. For example:
      -Dcom.magicsoftware.xpa.DefaultApplicationAndProgramNames="GSTest.HTML" or =GSTest (in the latter case, only the program name is mandatory in the request).

    • -Dcom.magicsoftware.xpa.HttpResponseMaxReuseTime=N This means that the Magic xpa servers will keep each HTTP response in the space for N seconds, to be reused in case a RIA client sends two (or more) successive identical requests (identical context ID and session counter).

    • -Dcom.magicsoftware.xpa.ServerLoadOnDemandTimeout=10 If a request is not served within a certain timeout (by default 10 seconds), then an additional Magic xpa server will be started. This Magic xpa server will be started on one of the servers defined in the projectsStartup.xml if the server was defined with AdditionalOnDemand > 0 and the number of Magic xpa servers currently running on this server did not exceed the sum of NumberOfInstances+AdditionalOnDemand.

    • -Dcom.magicsoftware.xpa.DefaultErrorFormatFileName= This is used to define a customized error template into which error details are merged before being sent to the Web requester. You should also set this in the Magic.ini file’s [JVM_ARGS] section for errors returned directly by Magic xpa servers. Since version: 3.1

      For example:

    • -Dcom.magicsoftware.xpa.ExcludeUrlDecodingForContentTypes= This is used to disable URL-decoding according to selected values of the HTTP header 'Content-Type' that is (optionally) sent within HTTP requests. This allows special characters, such as '%', to reach the Magic xpa server as-is. By default, if this system property is not set, no 'Content-Type' will be excluded, meaning that all requests will be URL-decoded, preserving the same behavior as the broker-based Web requesters (and GigaSpaces-based Web requesters up to V3.1). Since version: 3.2

      For example: set XAP_GSC_OPTIONS=... -Dcom.magicsoftware.xpa.ExcludeUrlDecodingForContentTypes=text/plain,text/xml will disable the URL-decoding of HTTP requests that include the HTTP header 'Content-Type' with either text/plain or text/xml.

    • -Dcom.magicsoftware.xpa.DefaultUserNameAndPassword=[user name][.password] This is used to define the default user name and password for non-RIA Web requests. (Since version: 3.2a) For example:

      • -Dcom.magicsoftware.xpa.DefaultUserNameAndPassword=supervisor – Only the username ('supervisor') will be passed to the Magic xpa server, without a password (similar to passing only &USERNAME= in a URL).

      • -Dcom.magicsoftware.xpa.DefaultUserNameAndPassword=supervisor.changeme – Both the username ('supervisor') and password ('changeme') will be passed to the Magic xpa server (similar to passing both &USERNAME=!!&PASSWORD=!! in a URL).

GigaSpaces settings: (Refer to GigaSpaces's documentation for the complete description.)

    • XAP_NIC_ADDRESS= This represents the specific network interface card IP address or the default host name.

    • DISCOVERY_PORT= This is used to set fixed discovery ports for the GigaSpaces infrastructure.

    • LRMI_PORT_RANGE= This also used to set fixed LRMI ports for the GigaSpaces infrastructure.

    • LOG_OPTIONS=-Dcom.gigaspaces.logger.RollingFileHandler.filename-pattern= The file path and system properties for the log options are set by the installation.

    • XAP_LOOKUP_LOCATORS= This is where you list the names of the host machines where the LUSs are started.

  • StartProjects.bat – Starts the projects defined in the Config\ProjectsStartup.xml file.

  • ShutdownProjects.bat – Stops the projects running in the space or all servers that serve a given project. For example: SutdownProjects GSTest.

  • gs-ui.bat – Starts the GigaSpaces Management Center.

  • gs-agent.bat – Starts the middleware space and loads the projects as well as another space for the data (database gateway). This file contains the following syntax: gsa.gsc 2 1 gsa.lus 1 0 gsa.deployAndStartProjects 1 gsa.deployDatabaseSpace 1

    This means that:

    • Two Grid Service Containers (GSC), one Grid Service Manager (GSM) and one Lookup Serivce (LUS) will be started.

    • Both spaces (for the middleware and for the database gateway) will be deployed (and the Magic xpa servers will be started via the middleware's space).

    • Setting the gsa.deployAndStartProjects entry to zero (0) means that the Space middleware will not be deployed and setting the gsa.deployDatabaseSpace entry to 0 means that the Space database will not be deployed.

b. Config folder – Contains configuration files for the space. Among the files in this folder are:

  • projectsStartup.xml – Defines the servers and projects that will be loaded when the space starts.

  • MgxpaGSSpace_sla.xml – Defines the SLA for the space.

  • log4j2.xml – Defines the log levels for the space-related activities.

  • – This optional file lets you control the concurrency of the HttpRequestsConvertor and HttpResponsesConvertor event containers. If the file is omitted or certain properties within the file are omitted, the default concurrency (1) remains. Since version: 3.2

This folder also contains the gsa subfolder with following files:

  • deployAndStartProjects.xml – Defines the mechanism that will deploy the middleware space and start the Magic xpa servers.

  • deployDatabaseSpace.xml – Defines the mechanism that will deploy the database space.

  • mgxpa.xml – Defines the mechanism that will start a Magic xpa server (MgxpaRuntime.exe).

c. Lib folder – Contains files required for starting and accessing the middleware and database spaces.

d. Monitor folder – Contains files required for monitoring the Magic xpa space.

e. OS_service folder – Contains the following files, which are required for starting the Magic xpa grid as a system service. Even if the service is not installed (Since version: 3.1), the files will be installed.

* bin\nssm.exe

* Scripts\Install_GSA_service.bat

* Scripts\Uninstall_GSA_service.bat

* Scripts\Stop_GSA_service.bat

* Scripts\Start_GSA_service.bat

* log folder

f. test folder – Contains test files to check that the space was started properly.

g. Apache-tomcat folder – Contains files required for executing web requests from an Apache-tomcat Web server ( Refer to the apache-tomcat\setenv.bat folder for setup instructions.

h. samples folder – Contains files that demonstrate a direct client, an EJB and a client accessing the EJB. Since version: 3.2

  1. Scripts\bin – ASP.NET Web requester.

  2. Scripts\config – Configuration files for the ASP.NET Web requester. In addition, Scripts\web.config allows configuring the ASP.NET Web requester’s logging.

Additional Magic xpa setup for the Space middleware

Depending on what machine you are using, there is some additional setup:

  • For an IIS machine: The MgWebRequester.dll file requires the installation of the Microsoft Visual C++ 2010 Redistributable package and the GigaSpaces installation folder.

  • For a Magic xpa Server machine: The GigaSpaces Monitor requires the installation of the Microsoft Visual C++ 2010 Redistributable package.

Since version: 3.0

The Magic xpa Single User Edition does not support the Space middleware.

Related Topics