[omniORB] Notification Service with omniorbPy
Anna Patil
patilanna at hotmail.com
Sat Aug 8 14:35:14 UTC 2020
Hi All,
I am trying get notifications from python, very new to CORBA, below is my first try. I am trying to pull notifications from ECI Lightsoft NMS in python3.6, everything is going well however while pulling structured events, getting below error.
onmniORBpy 4.3.0
CentOS 7
Python3.6
Please help me
3157 4954 5f4e 6f74 6966 794e 616d 6564 1WIT_NotifyNamed
526f 6f74 0049 545f 4e6f 7469 6679 4368 Root.IT_NotifyCh
616e 6e65 6c41 646d 696e 3a3a 4576 656e annelAdmin::Even
7443 6861 6e6e 656c 4661 6374 6f72 7900 tChannelFactory.
6368 616e 6e65 6c2d 3532 0063 6f6e 7375 channel-52.consu
6d65 722d 3532 2d30 0023 7374 7275 6374 mer-52-0.#struct
7572 6564 2d70 726f 7879 7075 6c6c 7375 ured-proxypullsu
7070 6c69 6572 2d35 322d 302d 306f 6e5f pplier-52-0-0on_
1600 0000 7075 6c6c 5f73 7472 7563 7475 ....pull_structu
7265 645f 6576 656e 7400 672e 0000 0000 red_event.g.....
omniORB: (2) 2020-08-07 17:58:57.857650: Scan for idle connections (1596803337,857523000)
omniORB: (2) 2020-08-07 17:58:57.857681: Scavenger reduce idle count for strand 0x1143b10 to 23
omniORB: (2) 2020-08-07 17:58:57.857692: Scavenger reduce idle count for strand 0x10b4550 to 23
omniORB: (2) 2020-08-07 17:58:57.857699: Scavenger reduce idle count for strand 0x111d2e0 to 23
omniORB: (2) 2020-08-07 17:58:57.857706: Scavenger reduce idle count for strand 0x11482d0 to 23
omniORB: (2) 2020-08-07 17:58:57.857713: Scavenger reduce idle count for strand 0x114cc20 to 23
omniORB: (2) 2020-08-07 17:58:57.857721: Scan for idle connections done (1596803337,857523000).
omniORB: (2) 2020-08-07 17:59:02.857869: Scan for idle connections (1596803342,857728000)
omniORB: (2) 2020-08-07 17:59:02.857904: Scavenger reduce idle count for strand 0x1143b10 to 22
omniORB: (2) 2020-08-07 17:59:02.857915: Scavenger reduce idle count for strand 0x10b4550 to 22
omniORB: (2) 2020-08-07 17:59:02.857923: Scavenger reduce idle count for strand 0x111d2e0 to 22
omniORB: (2) 2020-08-07 17:59:02.857930: Scavenger reduce idle count for strand 0x11482d0 to 22
omniORB: (2) 2020-08-07 17:59:02.857937: Scavenger reduce idle count for strand 0x114cc20 to 22
omniORB: (2) 2020-08-07 17:59:02.857944: Scan for idle connections done (1596803342,857728000).
omniORB: (2) 2020-08-07 17:59:07.858086: Scan for idle connections (1596803347,857952000)
omniORB: (2) 2020-08-07 17:59:07.858120: Scavenger reduce idle count for strand 0x1143b10 to 21
omniORB: (2) 2020-08-07 17:59:07.858132: Scavenger reduce idle count for strand 0x10b4550 to 21
omniORB: (2) 2020-08-07 17:59:07.858139: Scavenger reduce idle count for strand 0x111d2e0 to 21
omniORB: (2) 2020-08-07 17:59:07.858146: Scavenger reduce idle count for strand 0x11482d0 to 21
omniORB: (2) 2020-08-07 17:59:07.858153: Scavenger reduce idle count for strand 0x114cc20 to 21
omniORB: (2) 2020-08-07 17:59:07.858160: Scan for idle connections done (1596803347,857952000).
omniORB: (2) 2020-08-07 17:59:12.858307: Scan for idle connections (1596803352,858167000)
Python3.6 code
import sys
import CORBA
import CosNaming
import CosLifeCycle
import CosEventChannelAdmin
import CosNotifyComm__POA
import CosNotifyComm
import CosEventComm
from naming import *
sys.path.insert(0, '/home/anna/ECI_nms/corba')
import EventChannelAdmin
import emsSessionFactory
import nmsSession, nmsSession__POA
import globaldefs
import CosEventComm__POA
import CosNotification
import CosNotifyChannelAdmin__POA
import CosNotifyChannelAdmin
class NmsSession_I(nmsSession__POA.NmsSession_I):
pass
class psconsumer(CosEventComm__POA.PushConsumer):
def __init__(self):
pass
#def __init__(self, parent):
# self.parent = parent
#
#def push(self, data):
# if data._v == "response device":
# self.parent.eventFlag = True
# self.parent.localEvent.set()
#class ConsumerDevice_i(CosEventComm__POA.PushConsumer):
# pass
def main():
argv = ["-ORBInitRef", "NameService=corbaloc:iiop:1.2 at ABC-GJ-NMS:5075/NameService"]
#
# Start orb.
orb=CORBA.ORB_init(argv, CORBA.ORB_ID)
# Process Options
verbose=0
needNameService=0
channelName="EventChannel"
factoryName="EventChannelFactory"
criteria=[]
action="start"
try:
#
# Get Name Service root context.
rootContext=None
try:
action="resolve initial reference 'NameService'"
obj=orb.resolve_initial_references("NameService")
rootContext=obj._narrow(CosNaming.NamingContext)
if rootContext is None:
raise CORBA.OBJECT_NOT_EXIST(0,CORBA.COMPLETED_NO)
except CORBA.Exception as ex:
if needNameService:
raise ex
else:
sys.stderr.write("Warning - failed to %s\n"%action)
name = [CosNaming.NameComponent("TMF_MTNM","Class"),
CosNaming.NameComponent("ECI","Vendor"),
CosNaming.NameComponent("ECI:LightSoft_1","EmsInstance"),
CosNaming.NameComponent("3_5","Version"),
CosNaming.NameComponent("ECI:LightSoft_1","EmsSessionFactory_I")]
try:
obj = rootContext.resolve(name)
except CosNaming.NamingContext.NotFound as ex:
print("Except->Name not found")
print(ex)
try:
poa = orb.resolve_initial_references("RootPOA")
except Exception as ex:
print('POA initial References Error: {}'.format(ex))
try:
poaManager = poa._get_the_POAManager()
except Exception as ex:
print('POA get manager error : {}'.format(ex))
try:
poaManager.activate()
except Exception as ex:
print('POA manager Activation Error: {}'.format(ex))
### Narrow the object
ems_session = obj._narrow(emsSessionFactory.EmsSessionFactory_I)
if ems_session is None:
print("Object reference is not an EmsSessionFactory_I")
### Get NMS session
nms_session_i = NmsSession_I()
nms_session_o = nms_session_i._this()
if nms_session_o is None:
print("Object reference is not an NmsSession_I")
sys.exit(1)
##Get ems Session ###
try:
session = ems_session.getEmsSession("usr", "Aug at 2020", nms_session_o)
#print(dir(session))
except Exception as ex:
print('System Error: {}'.format(ex))
sys.exit(1)
#print(dir(session))
try:
eventChannel = session.getEventChannel()
except globaldefs.ProcessingFailureException as ex:
print('System Error: {}'.format(ex))
eventChannel.destroy()
session.endSession()
sys.exit(1)
cadmin = eventChannel.default_consumer_admin
try:
psupp, prxID = cadmin.obtain_notification_pull_supplier(CosNotifyChannelAdmin.STRUCTURED_EVENT)
pxsupp = psupp._narrow(CosNotifyChannelAdmin.StructuredProxyPullSupplier)
except Exception as ex:
print(ex)
try:
s_proxy_pull_supplier = pxsupp._narrow(psupp)
except Exception as ex:
print('Error: {}'.format(ex))
try:
events = s_proxy_pull_supplier.pull_structured_event()
except Exception as ex:
print('Events Error: {}'.format(ex))
except CORBA.Exception as ex:
sys.stderr.write("CORBA exception, unable to %s.\n"%action)
session.endSession()
orb.shutdown(1)
sys.exit(1)
################################################################################
# If this file is executed directly, then we start here.
if(__name__=="__main__"):
main()
orb.run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.omniorb-support.com/pipermail/omniorb-list/attachments/20200808/32b48eb7/attachment.html>
More information about the omniORB-list
mailing list