Problem:
- Product Name: VisiBroker
- Product Version: 5.2.1
- Product Component: Name Service
- Platform/OS Version: ALL
- JDK/Compiler Version: Supported JDKs
How to obtain Naming Service Factory / Cluster Manager without osagent?
Resolution:
The following code is working from Visibroker 5.2.1 onward.
Prior to VBE 5.2.1, an application needs to rely on the Smart Agent to obtain the reference to the Naming Service Factory, which can also resolve the reference of the Cluster Manager object. However, starting VBE 5.2.1, an application can use the steps below to obtain the reference to the Naming Service Factory without the Smart Agent.
The Naming Service Factory has the alias name of "ExtendedFactory", and it also has an API that returns the root context of the Name Service. Here is a code snippet that shows how to obtain the Name Service Factory, which helps to return the reference to the root name context and the Cluster Manager.
...
org.omg.CORBA.Object rootAsObj = orb.resolve_initial_references("ExtendedFactory");
com.inprise.vbroker.CosNamingExt.ExtendedNamingContextFactory factory = com.inprise.vbroker.CosNamingExt.ExtendedNamingContextFactoryHelper.narrow(rootAsObj);
//Now get the root context from the factory
org.omg.CosNaming.NamingContext rootCtx = factory.root_context();
//Now get the cluster manager from the factory
ClusterManager clusterMgr = factory.get_cluster_manager();
...
When running this piece of code, be sure to pass the following ORB parameters:
>vbj -DORBInitRef=ExtendedFactory=corbaloc::/ExtendedFactory [-Dvbroker.agent.enableLocator=false] ... ...
(optionally turn off the osagent by using the second parameter to reduce overhead)
#VisiBroker
#Security




