Inter PB components calls(this howto is deprecated)Tag(s): DEPRECATED


Calling another component on the same Jaguar instance is simple and fast.
TransactionServer ts
nvo_othercomponent lnvo_theothercomponent
GetContextService("TransactionServer", ts)
ts.CreateInstance(lnvo_theothercomponent, 'mypackage/nvo_othercomponent')
ls_return = lnvo_theothercomponent.of_say('hello world')
SetNull(lnvo_theothercomponent)
SetNull(ts)
This time, the call is made through the load balancing Name Service (if there is a cluster).

To get definitions into PowerBuilder for Factory/Session/Manager (which are Java classes), just use the PB7's "Jaguar Proxy Generator" (Menu.File.New.Project.JaguarProxyWizard) and select all components of SessionManager (there's a checkbox for that I think). This will create proxies to the: Factory, Session, and Manager -- to be used by your PB components.

JaguarORB l_JaguarORB
CORBAObject l_CorbaObject
Manager l_manager
Session l_session
Factory l_factory
nvo_othercomponent lnvo_theothercomponent
l_JaguarORB = CREATE JaguarORB
ll_return = l_JaguarORB.init("ORBRetryCount=3, ORBRetryDelay=1000")
ll_return = l_JaguarORB.String_To_Object &
               ("iiop://JagOne:9000;iiop://JagTwo:9000",l_CorbaObject)
ll_return = l_CorbaObject._narrow(l_manager, "SessionManager/Manager")
l_session = l_manager.createSession("jagadmin", "")
l_Factory = l_session.lookup("mypackage/nvo_othercomponent")
l_CorbaObject = l_Factory.create()
l_CorbaObject._narrow &
  (lnvo_theothercomponent, "mypackage/nvo_othercomponent")
ls_return = lnvo_theothercomponent.of_say('hello world')
SetNull(lnvo_theothercomponent)
SetNull(l_CorbaObject)
SetNull(l_manager)
SetNull(l_session)
SetNull(l_JaguarORB)
Now the call is made directly to another Jaguar (in a cluster), bypassing/ignoring the Name Service.
JaguarORB l_JaguarORB
CORBAObject l_CorbaObject
Manager l_manager
Session l_session
Factory l_factory
nvo_othercomponent lnvo_theothercomponent
l_JaguarORB = CREATE JaguarORB
ll_return = l_JaguarORB.init("ORBRetryCount=3, ORBRetryDelay=1000")
ll_return = l_JaguarORB.String_To_Object&
  ("iiop://JagOne:9000",l_CorbaObject)
ll_return = l_CorbaObject._narrow(l_manager, "SessionManager/Manager")
l_session = l_manager.createSession("jagadmin", "")

l_session.lookup("mypackage/nvo_othercomponent")
l_CorbaObject = l_session.create("mypackage/nvo_othercomponent")
l_CorbaObject._narrow &
   (lnvo_theothercomponent, "mypackage/nvo_othercomponent")
ls_return = lnvo_theothercomponent.of_say('hello world')
SetNull(lnvo_theothercomponent)
SetNull(l_CorbaObject)
SetNull(l_manager)
SetNull(l_session)
SetNull(l_JaguarORB)

Thanks to RobbGolds


blog comments powered by Disqus