Domain Rule

Domain rules are triggered automatically when the platform reboots. This comes handy when you want to centralize some kind of activities like initializing caches, databases, incrementing counters, etc.

Example

def SERVICE_URLS = grid.stringSet("SERVICE_URLS");
def API_KEYS = grid.stringCahe("API_KEYS");

if(SERVICE_URLS.isEmpty()){
  SERVICE_URLS.add("https://domain.name/my/cool/rest/service");
  SERVICE_URLS.add("https://alternate.domain.name/my/cool/rest/service");
}

if(API_KEYS.isEmpty()){
  API_KEYS.put("my.service.token", "12asd0012s");
  API_KEYS.put("another.credential" ,"secret");
}

Recommended Context APIs

Distributed Set
Distributed Queue
Distributed Cache
Distributed Sequence
Distributed Atomic Long
Distributed Countdown Latch
Distributed Lock
Distributed Semaphore