[omniORB] omniEvents pushsupp.cc vs pushsupp.py CORBA.BAD_PARAM

Chris McClimans omniorb@mcclimans.net
Tue, 12 Feb 2002 17:52:57 -0600


I am trying to port pushsupp.cc and friends to omniORBpy.
I checked CosEventChannelAdmin.idl and it says
ProxyPushConsumer.connect_push_supplier() should take a single
CosEventComm.PushSupplier as it's argument. I printed out the
supplier._NP_RepositoryId and it looks to be of the right type to pass
to this function.
What else might be going on here?
-chris

chris@ginger-ale% python ./pushsupp.py
About to Call proxy_consumer.connect_push_supplier(supplier)
Where suppplier._NP_RepositoryId is IDL:omg.org/CosEventComm/PushSupplier:1.0
Traceback (most recent call last):
  File "./pushsupp.py", line 48, in ?
    proxy_consumer.connect_push_supplier(supplier)
  File "CosEventChannelAdmin_idl.py", line 76, in connect_push_supplier
    return _omnipy.invoke(self, "connect_push_supplier", _0_CosEventChannelAdmin.ProxyPushConsumer._d_connect_push_supplier, args)
omniORB.CORBA.BAD_PARAM: Minor: 0, Completed: COMPLETED_NO.

-- pushsupp.py
#!/usr/bin/env python
from omniORB import CORBA
import CosNaming, CosLifeCycle, CosEventChannelAdmin, CosEventComm
import EventChannelAdmin, sys

orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)

# Use NameService and get an omniEvents EventChannelFactory reference
obj         = orb.resolve_initial_references("NameService")
rootContext = obj._narrow(CosNaming.NamingContext)
name = [CosNaming.NameComponent('EventChannelFactory',
				'EventChannelFactory')]
obj = rootContext.resolve(name)
EventChannelFactory = obj._narrow(EventChannelAdmin.EventChannelFactory)

# Use the EventChannelFactory to get an EventChannel
key = [CosNaming.NameComponent('EventChannel','object interface')]
criteria=[CosLifeCycle.NVP('PullRetryPeriod',CORBA.Any(CORBA.TC_ulong,1)),
          CosLifeCycle.NVP('MaxEventsPerConsumer',CORBA.Any(CORBA.TC_ulong,0)),
          CosLifeCycle.NVP('MaxQueueLength',CORBA.Any(CORBA.TC_ulong,0))]
channelObj = EventChannelFactory.create_object(key,criteria)
EventChannel = channelObj._narrow(CosEventChannelAdmin.EventChannel)
            
# the following logic comes from pushsupp.cc from omniEvent/examples/

# Make a PushSupplier Class and instance
class Supplier_i(CosEventComm.PushSupplier):
    def __init__(self):
        pass
    def disconnect_push_supplier(self):
        print "EventSupplier: disconnectied."

supplier = Supplier_i()

# get the EventChannelAdmin for the Supplier
supplier_admin = EventChannel.for_suppliers()

# get a ProxyConsumer from our EventChannelAdmin
proxy_consumer = supplier_admin.obtain_push_consumer()

print "About to Call proxy_consumer.connect_push_supplier(supplier)"
print "Where suppplier._NP_RepositoryId is " + supplier._NP_RepositoryId
# here is where we get a CORBA.BAD_PARAM
proxy_consumer.connect_push_supplier(supplier)