Previous | Table of Contents | Next |
The following example of the server-side main() assumes a C++ implementation of the StockManager interface called StockManager_impl.
#include <StockManagerImpl.h> // Implementation header
int main(int argc, char ** argv){// Initialize the ORBCORBA::ORB_var orb = CORBA::ORB_init(argc, argv);// Obtain the POAPortableServer::POA_var poa =
orb->resolve_initial_references("RootPOA");
// Create a POA that supports Unshared transactions and processes// queued requests in priority orderCORBA::Any policy_val;CORBA::PolicyList pols(2);pols.length(2);
policy_val <<= (Messaging::PRIORITY | Messaging::DEADLINE);pols[(CORBA::ULong) 0] = orb->create_policy(Messaging::QUEUE_ORDER_POLICY_TYPE,policy_val);
policy_val <<= CosTransactions::Allows_either;pols[(CORBA::ULong) 1] =orb->create_policy(CosTransactions::TRANSACTION_POLICY_TYPE, policy_val);
poa = poa->create_POA("MessagingPOA",PortableServer::POAManager::_nil(),pols);
// Instantiate the servant.StockManager_impl* stockMgr = new StockManager_impl("NYSE");// register the servant for use.PortableServer::ObjectId_var servantId =
poa->activate_object(stockMgr);orb->run();return 0;}
Section III - Message Routing Interoperability