[Ace-users] Re: how to get ChannelID from EventChannel_ptr

Evan Carew carew at pobox.com
Wed Jul 18 09:20:27 CDT 2007

lily wrote:
> On 7 13 ,   9 24 , Evan Carew <ca... at pobox.com> wrote:
> lily,
> What would you like to do with this Channel ID? A little background info
> might help shake some useful ideas from the trees.
> Evan

> Hi
>   I'm transplanting to TAO and In the original program the Channel ID
> is kept to get the event channel point after the program restart.

>  Now I use name service to get the event channel point and want to get
> the Channel ID to leave the original interface unchanged.

> Thanks a lot
Since you haven't specifically stated it, it sounds like you are
supporting both a client and server app. Speaking specifically to the
server, it sounds like you are now using the NamingService to provide
persistent service registrations. THis registration will then persist in
the naming service until the originator removes it. In the event that
the originator crashes, without removing the registration, it will still
be visible in the naming service cache.

Ok, so on to event processing. I use the following code to connect to a
basic event channel. It's the same for most of the programs I do, ans is
nothing more than boilerplate code. Perhaps you could point out in this
code what you'd like to be doing.

/** \fn void get_ProxyEventConsumer(int argc, char **argv,
CORBA::ORB_var &orb, const char* POAName)
 * Function for generating a
CosEventChannelAdmin::ProxyPushConsumer_var. This function encapsulates
the boilerplate
 * needed for the simple variety of event channel, i.e. the one not
interested in consumer disconnection. This function
 * us useful for servers (suppliers of events).
void get_ProxyEventConsumer(int argc, char **argv, const char* POAName,
CORBA::ORB_var &orb, CosEventChannelAdmin::ProxyPushConsumer_var
  //Now we need a reference to the naming service
  Object_var naming_context_object = orb->resolve_initial_references
  naming_context = CosNaming::NamingContext::_narrow
(naming_context_object.in ());

  CosNaming::Name ec_name;
  ec_name[0].id = CORBA::string_dup("CosEventService"); //TAO Specific

    // Resolve the binding to the event channel object reference.
  CosEventChannelAdmin::EventChannel_var channel =
      naming_context, ec_name);

  // Get the admin object to the event channel
  CosEventChannelAdmin::SupplierAdmin_var supplier_admin =

  // Obtain a ProxyPushConsumer from the SupplierAdmin.
  event_consumer =  supplier_admin->obtain_push_consumer();

  // Invoke the connect_push_supplier operation, passing
// a nil PushSupplier reference to it.
  CosEventComm::PushSupplier_var nil_supplier =

More information about the Ace-users mailing list