0
votes

In a cluster configuration made up of 2 WSO2 ESB 4.8.1, i need to develop a machanism by which the two ESB can access a shared Map Object writing and reading it.

In particular i was thinking about developing a custom class mediator deployed on both the esb which can access a Map Object stored inside a WSO2 Governance Registry.

I have already integrate an instance of the WSO2 Governance Registry with the 2 ESB. Now i need to know:

1) is there a client code sample by wich i can find, access a resource on the governance registry and update it?

2) in which section of the registry can i store the Map object?

Thanks

1

1 Answers

0
votes

I have given the answer for your questions in WSO2 Governance API from WSO2 ESB Mediator. But personally I think best way to achieve this writing a new cache manager using underlying wso2 caching implementation.

Here is a sample code.

import javax.cache.Cache;
import javax.cache.CacheBuilder;
import javax.cache.CacheManager;
import javax.cache.Caching;
....

....
CacheManager cacheManager =  Caching.getCacheManagerFactory().getCacheManager("CustomCacheManager");
CacheBuilder<String, Object> cacheBuilder = cacheManager.createCacheBuilder("MapCache");
Cache<String, Object> cache =  cacheBuilder.build();
cache.put("key", "value");

Here is how values retrieve in remote node.

CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("CustomCacheManager");
Cache remoteCache = cacheManager.getCache("MapCache");
String value = (String) cache.get("key"); 

Hope you will be able to find the best solution for your problem.