1

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!

tee4cute
  • 25
  • 5

1 Answers1

1
  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))
    
    }
    
itaifrenkel
  • 1,578
  • 1
  • 12
  • 26
  • Thanks @itaifrenkel. But I've some constraints that prevent us to use ElasticStatefulProcessingUnitDeployment. "We want to use dynamic/random generated SPACE/PU name at runtime." So, if we use ElasticStatefulProcessingUnitDeployment, we must predefined SPACE/PU name in descriptor file (pu.xml). FYI, we are developing platform that uses XAP as underlying platform and we allow our users to access VM's resources (such as space, processing component etc.) via our provided API only. The users will not know that XAP is behind the scene and not allow to upload .jar to the VM instance directly. – tee4cute Oct 14 '13 at 10:27
  • The pu.xml does not have to change. See code sample I added to the answer – itaifrenkel Oct 14 '13 at 12:58
  • Wow! This seems to be the silver bullet for me. But... just another further question. If I want to secure the backend DB by using random generated credentials to access dbms (each SPACE/PU will have its own credentials to connect to dbms - for security reasons). And each DataSource/DataSync implementation has its own configurations (Cassandra, MongoDB, Hibernate... configs are not the same). How can I provide that configs to the PU?. If there is not the straight way, can we use generated temp pu.xml file to deploy each PU and delete them right after deployment has finished? – tee4cute Oct 14 '13 at 13:14
  • You are supposed to open new questions for that in SO :) But check the ElasticStatefulProcessingUnitDeployment JavaDoc for the userDetails() method. Use different datagrid folder for each backend or use spring profiles. There is no need to create temp files. – itaifrenkel Oct 14 '13 at 13:29