[omniNotify] resolving Notification Service

Janet Tvedt tvedt@noao.edu
Thu Jan 30 16:24:02 2003


Andy,

I don't know the answer to your question about whether or not you
should/can use resolve_initial_references to find the notification
service.  However, you can use this call to find the naming service:

CORBA::Object_var name_service;
CosNaming::NamingContext_var name_context;
name_service = orb->resolve_initial_references("NameService");
name_context = CosNaming::NamingContext::_narrow(name_service);

Then use the name service to locate the channel factory and/or default
event channel:

  CosNaming::Name name;
  name.length(1);
  name[0].id   = CORBA::string_dup((const char*)"EventChannel");
  name[0].kind = CORBA::string_dup((const char*)"EventChannel");
  CORBA::Object_var channel_ref = name_context->resolve(name);

Have a look at at omniNotify/examples/get_channel.h for details.

Janet Tvedt

On Thu, 2003-01-30 at 03:26, Andy Goetz wrote:
> Hi,
> 
> I have partly resolved my problem of bootstrapping. In my program which
> was converting the ior to an EventChannel I had mistyped /tmp/rdfact.ior
> and /tmp/rdchan.ior ! Once I had corrected this stupid mistake I could
> correctly resolve these two references to their correct types. I still
> cannot get the resolve_initial_references on "NotificationService" to
> work however.  Is this supposed to work ? I do not see it being used in
> any of the examples.
> 
> Now I get a CORBA::SystemException when I try to :
> 
> structuredProxyPushConsumer -> connect_structured_push_supplier(
>                  CosNotifyComm::StructuredPushSupplier::_nil());
> 
> Up to then everything seems to work fine. Any ideas about what the
> beginner is doing wrong again ?
> 
> Thanks
> 
> Andy
> 
> On Thu, 30 Jan 2003, Andy Goetz wrote:
> 
> > Hi,
> > 
> > I am new to omniNotify so please be patient if my question has an obvious
> > answer.
> > 
> > I am trying to get a VERY simple example working with a server and client
> > for omniNotify building them from scratch. I have hacked the examples code
> > to send my own events but I do not find it very clear. I would like to
> > write a server and client from scratch using the COS Notification API
> > directly. My first example fails just trying to get the
> > EventChannelFactory.
> > 
> > My code to get a handle on the EventChannelFactory looks like this :
> > 
> >     CosNotifyChannelAdmin::EventChannel_var eventChannelFactory;
> >     try
> >     {
> >         CORBA::Object_var obj =
> >             orb -> resolve_initial_references("NotificationService");
> >  
> >         //
> >         // Narrow the CORBA_Object reference to an EventChannelFactory
> >         // reference so we can invoke its methods
> >         //
> >         eventChannelFactory =
> >             CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj);
> >  
> >     }
> >     catch(...)
> >     {
> >         cerr << "Cannot resolve `NotificationService'" << endl;
> >         exit(1);
> >     }
> >  
> >     //
> >     // Make sure the CORBA object was really an EventChannelFactory
> >     //
> >     if(CORBA::is_nil(eventChannelFactory))
> >     {
> >         cerr << "`NotificationService' initial reference is not "
> >              << "a CosNotifyChannelAdmin::EventChannelFactory"
> >              << endl;
> >         exit(1);
> >     }
> > 
> > But it never resolves the EventChannelFactory. I have tried resolving the
> > IOR in the /tmp/rdifact.ior file as well but when I do the narrow it says
> > this is not an EventChannelFactory.
> > 
> > My questions are :
> > 
> > (1) is the bootstrap method via "NotificationService" supported ?
> > 
> > (2) why can I not narrow /tmp/rdifact.ior to
> >     
> >     CosNotifyChannelAdmin::EventChannelFactory ?
> > 
> > Thanks for any help you can give on this.
> > 
> > Andy Gotz
> > 
> > --
> > European Synchrotron Radiation Facility
> > 6, rue Jules Horowitz, 
> > Grenoble, 38043 
> > FRANCE
> > 
> > tel: (+33)-476882646
> > 
> > email: goetz@esrf.fr
> >        andy_gotz@yahoo.fr
> > 
> > _______________________________________________
> > omninotify-list mailing list
> > omninotify-list@omniorb-support.com
> > http://www.omniorb-support.com/mailman/listinfo/omninotify-list
> > 
> 
> --
> European Synchrotron Radiation Facility
> 6, rue Jules Horowitz, 
> Grenoble, 38043 
> FRANCE
> 
> tel: (+33)-476882646
> 
> email: goetz@esrf.fr
>        andy_gotz@yahoo.fr
> 
> _______________________________________________
> omninotify-list mailing list
> omninotify-list@omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omninotify-list