[omniORB] A newbie question (well, maybe more than one)

Ulf Stoermer ulf at emi.yamaha.co.jp
Thu Jun 19 11:26:42 BST 2003


Hi Eric,

> ORB_init(argc, argv)

The arguments are just a handy way for configuring the orb.
Normally omniORB looks at the configuration file, by default
etc/omniORG.cfg.
If for example you just temporarily want to change these configuration
parameters
you can specify them on the shell command line and they will be passed on to
the orb.
The most often used example is to set the orb's trace level:
$ ./exampleserver -ORBtraceLevel 40

But of course, you can omit all this and simply write:
   int argc = 0 ;
   CORBA::ORB_init( argc, 0 );


> [multiple server objects]

Of course, you can have as many server objects as you like.
Just create the objects, register them with the POA and activate them.
Take a look at the echo example $OMNIROOT/src/examples/echo/eg1.cc
In the main function you will find following 3 lines:

    Echo_i* myecho = new Echo_i();
    PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);
    Echo_var myechoref = myecho->_this();

Just replicate these lines and you already have a second server object
ready to receive requests:

    Echo_i* mysecondecho = new Echo_i();
    PortableServer::ObjectId_var mysecondechoid =
poa->activate_object(mysecondecho);
    Echo_var mysecondechoref = mysecondecho->_this();

Of course, this is just a simple example. The two objects are now registered
with
the root POA. In case you have lots, maybe thousands of objects you might
want
create multiple POAs to distribute the workload or to have them work with
different
policies. But you have already the right reference, Henning/Vinoski discuss
these
issues in their book. For a beginner all that CORBA stuff not always makes
immediately
sense (neither does it with COM), so just keep on studying :-)

Cheers

Ulf






More information about the omniORB-list mailing list