[omniORB] omniORBpy StructuredPushConsumer

Dan Ellis dan.ellis at ipaccess.com
Thu Mar 16 23:10:27 GMT 2006


Hi,

I'm new to omniORB, but I've been trying to write a small Python script to
simulate a problematic service we have. When I tried to run the script earlier,
I was getting an exception whenever an event was received. I was trying to
reproduce that now, but now I'm just getting my incoming connections reset. The
code is below. Is there anything obviously wrong with it? Output shown below the
code. Any help greatly appreciated, as the issue is pressing.

Thanks,
Dan.

----------------------------------------------------
import sys
from omniORB import CORBA
import CosNaming, CosNotification, CosNotifyComm__POA, CosNotifyChannelAdmin

class MyConsumer(CosNotifyComm__POA.StructuredPushConsumer):
    def __init__(self, orb):
        print "Initialising consumer..."
        self.orb = orb
        print "... done"

    def disconnect_structured_push_consumer(self):
        print "Shutting down orb..."
        self.orb.shutdown(0)
        print "... done"

    def offer_change(self, added, remove):
        pass
    
    def push_structured_event(self, notification):
        print "Consumer invoked"

orb = CORBA.ORB_init()
print "orb is type", repr(orb)
poa = orb.resolve_initial_references('RootPOA')
print "poa is type", repr(poa)

ns = orb.string_to_object("corbaloc:iiop:ocbsci02.mgmt:10200/NameService")
ns = ns._narrow(CosNaming.NamingContext)
print "ns is type", repr(ns)

ec = ns.resolve([
    CosNaming.NameComponent("aux", ""),
    CosNaming.NameComponent("EventChannel", "")
    ])
ec = ec._narrow(CosNotifyChannelAdmin.EventChannel)
print "ec is type", repr(ec)

admin = ec._get_default_consumer_admin()
supplier, subid =
admin.obtain_notification_push_supplier(CosNotifyChannelAdmin.STRUCTURED_EVENT)
supplier = supplier._narrow(CosNotifyChannelAdmin.StructuredProxyPushSupplier)
print "supplier is type", repr(supplier)
print "Subscription ID:", subid

consumer = MyConsumer(orb)
poa.activate_object(consumer)
supplier.connect_structured_push_consumer(consumer._this())

orb.run()
----------------------------------------------------
C:\Documents and Settings\de1\My Documents\NetexTest>netextest
orb is type <omniORB.CORBA.ORB instance at 0x009B54E0>
poa is type <omniORB.PortableServer.POA instance at 0x009CFC38>
ns is type <CosNaming._objref_NamingContext instance at 0x009C9A58>
ec is type <CosNotifyChannelAdmin._objref_EventChannel instance at 0x009C9C10>
supplier is type <CosNotifyChannelAdmin._objref_StructuredProxyPushSupplier
instance at 0x009D50A8>
Subscription ID: 32
Initialising consumer...
... done
[This is where the "unknown exception" was occurring before, but I'm unable to
reproduce that, as now the ORB is closing connections made to it. The exception
shown in Ethereal was UNKNOWN, repeated several times in response to the same
request.]

-- 
Dan Ellis, Software Engineer, BSC Team
ip.access ltd  < http://www.ipaccess.com >
Building 2020, Cambourne Business Park, Cambourne, Cambridge, CB3 6DW
Tel: 01954 713790, Fax: 01954 713799



More information about the omniORB-list mailing list