[omniORB] omniEvents - eventc.cc vs eventc.py

Chris McClimans omniorb@mcclimans.net
Tue, 12 Feb 2002 01:42:05 -0600


I'm trying to port eventc.cc to python to learn a bit about the interface.
The eventc compiled from the omniEvents distribution works fine, however my
code below must be doing somthing different. I'm probably doing something
wrong here but it is not obvious to me where the problem is.

$ python eventc.py

Traceback (most recent call last):
  File "eventc.py", line 21, in ?
    channel = EventChannelFactory.create_object(key,criteria)
  File "/home/chris/include/CosLifeCycle_idl.py", line 221, in create_object
    return _omnipy.invoke(self, "create_object", _0_CosLifeCycle.GenericFactory._d_create_object, args)
omniORB.CORBA.BAD_PARAM: Minor: 0, Completed: COMPLETED_NO.

$ cat eventc.py

from omniORB import CORBA
import CosNaming, CosLifeCycle, EventChannelAdmin
import sys

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

# Obtain a reference to the root naming context and get the EventChannelFactory
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)

key = [CosNaming.NameComponent('EventChannel','object interface')]
EventChannelFactory.supports(key) # test

criteria = [CosLifeCycle.NameValuePair('PullRetryPeriod',1),
            CosLifeCycle.NameValuePair('MaxEventsPerConsumer',0),
            CosLifeCycle.NameValuePair('MaxQueueLength',0)]

channel = EventChannelFactory.create_object(key,criteria) ##### This Generates a BAD_PARAM

###########

key is a sequence of CosNaming.NameComponent
criteria is a sequence of CosLifeCycle.NameValuePair (I also tried CosLifeCycle.NVP)

Those seem like the right params to me. It's late I'll dig into the omniEvents source tomorrow
to understand what's happening. Thanks to any who can provide any enlightenment.
-chris