How to configure GigaSpaces XAP persistency for ElasticSpaceDeployment PROGRAMMATICALLY?

StackOverflow https://stackoverflow.com/questions/19313788

  •  30-06-2022
  •  | 
  •  

Question

I'm using GigaSpaces XAP 9.6 and want to deploy ElasticSpaceDeployment (space-only PU) programmatically (via Admin API) by passing persistency configurations (SpaceDataSource, SpaceSynchronizationEndpoint) at deployment time.

For now, I can deploy ElasticSpaceDeployment programmatically without persistency configurations (GSM will choose "DEFAULT" space schema to deploy PU). But I cannot find any API to setup persistency configurations or set the space schema to "PERSISTENT" at deployment time.

I've tried to deploy the PU with "DEFAULT" schema and use UrlSpaceConfigurer to configure the persistency like :

GigaSpace gigaSpace = new GigaSpaceConfigurer(new UrlSpaceConfigurer("jini://...") .schema("persistent") .cachePolicy(new LruCachePolicy()) .spaceSynchronizationEndpoint(...) .spaceDataSource(...) .space()).gigaSpace();

I know that using the code above GS will return found space (if exists) or create the new one (if not exists). So, this code is not trying to reconfigure the space configurations instead of obtaining them.

Additionally, When I deploy ElasticSpaceDeployment, GS will automatically create the space for this PU with "DEFAULT" schema (without persistency configs). So ....

1) How can I define the persistency configs for the ElasticSpaceDeployment PU at deployment time?

2) Or, how can I reconfigure the space's persistency configs? (deploy it and reconfigure it later)

Thanks for your HELP!

Was it helpful?

Solution

  1. copy $GSHOME/deploy/templates/datagrid into a new folder (/myproject/datagrid-persistency) and modify META-INF\spring\pu.xml to include the persistency configuration. http://wiki.gigaspaces.com/wiki/display/XAP96/Asynchronous+Persistency+with+the+Mirror

  2. Instead of ElasticSpaceDeployment use ElasticStatefulProcessingUnitDeployment and provide a File pointing to /myproject/datagrid-persistency folder as a parameter. http://www.gigaspaces.com/docs/JavaDoc9.6/org/openspaces/admin/pu/elastic/ElasticStatefulProcessingUnitDeployment.html#ElasticStatefulProcessingUnitDeployment(java.io.File)

    public void deploy (GridServiceManager gsm, String tenantName) {
    
        gsm.deploy(
                new ElasticStatefulProcessingUnitDeployment("/myproject/datagrid-persistency")
                .name(tenantName))
    
    }
    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top