WSO2 class mediator for accessing Governance Registry Resource - wso2

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

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.

Related

WSO2 APIM storing files in gov registry

I have another question on WSO2 APIM 2.6.0
I am working in one scenario where I have to store one file which is in json in gov registry. I can do that manually from the dashboard but I am looking for a way to perform that using API or in automated way.
Research done till now
1) Checking on the link which ideally enable WSO2 ESB to maintain a remote registry. But I am unable to get how the registry DB will be shared between the applications (APIM and ESB).
Like, ESB has property where we can store the data in registry directly from proxy or an API and also enables us to retrieve them accordingly.
But how do we do in APIM to store the file with json content.
Any suggestions here.
Thanks

Access programmatically WSO2 BAM registry

I know I can access the WSO2 Governance Registry programmatically using the API. Is it also possible to access and upload/modify information on another (non GREG) servers'registry and how?
Is the approach the same? Is it possible to upload hive scripts for example on BAM programically?
Accessing embedded registry from a 'non GREG' WSO2 product using the registry API, is described here [1] in WSO2 Application Server documentation page.
[1] http://docs.wso2.org/display/AS520/Basic+Registry+API+Knowledge
Thanks,
Isuruwan

Unable to Initialise WSO2 governance registry?

I am trying to customize the index.jsp for wso2 governance registry. I am trying to get the list of all the services that were being added into the registry. And also I want to add functionality like searching for the services in the index.jsp. I am trying to intialize the Registry object ? I am wondering how to get the Registry object. Can any one suggest me how to do that ? so that once I can get the Registry object, I will use Resource object to search in the Registry.
Resource governanceFolder = registry.get("/_system/governance");
But how to get that registry object ?
I tried Registry registry = initialize(); which did not work. Can any one help me ?
What is the GREG version you are using ? In the case if you are using latest GREG (4.5.3) services are also considered as Configurable governance artifacts, Therefor you can follow http://ajithvblogs.blogspot.com/2013/02/how-to-invoke-custom-artifacts-using.html to get list of services.
In case if you are using an old version of GREG you may have to use the corresponding Admin Service to list services.
You can find [1] to initialize the registry object.
Registry governanceRegistry = GovernanceUtils.getGovernanceUserRegistry(registry, userName);
ServiceManager serviceManager = new ServiceManager(governanceRegistry);
Service[] services = serviceManager.getAllServices();
Find more details on Governance Registry documentation.

WSO2 GovernanceServer and Google Protocol buffers

We are starting to look at WSO2 Governance Registry software for our SOA Governance(so I'm just beginning to dig into this product). I see that you can auto-build governance data by pointing to a WSDL if you use web services.
Does anyone know if there is any way to do this auto-build by pointing to a Google Protocol Buffer .proto file?
This has our Message formats, and our Service details, so it would be very nice to be able to do that.
IF there isn't anything like that, COULD something be developed to do that (and if so, and pointers to the documentation I would need would be great!).
We are NOT using WebServices, so no WSDL's.....
Thanks!
This capability of pointing to a proto file and crating a service is not possible with WSO2 Governance Registry now.
However it is possible to add this as a new feature, and should be a simple implementation. AFAIK, this will be as simple as creating a handler to deal with proto file as a media type, and do the same stuff we do for a WSDL in that handler, and create a service out of that.
Having a WSDL is not a must to create a service. We can represent non-SOAP services too, in WSO2 Governance Registry.

wso2 product Registry menu (config, governance, local)

Is there any authoritative documentation available for data found under the Registry UI menu (for example as found in WSO2 ESB admin screens)?
I have seen snippets of information about this registry, for example:
The configuration registry contains product specific configuration
that can be shared across multiple instances of the same product (a
cluster of ESB nodes for example).
Source: link
To start with, I have a few questions:
What is the difference between this registry and the WSO2 Governance Registry?
What are the typical use cases for a WSO2 esb admin user for interacting with this Registry?
What are the typical use cases for a WSO2 esb developer for interacting with this Registry?
Is there a description of all the meta data stored in this registry?
In All WSO2 products there is an internal registry which is used to store resources. WSo2 Governance Registry uses the same core features + some more feature that gives complete Governance scenario. If you need you can mount to an external WSo2 Governance Registry without using the internal registry you referred.You can find more details here.