Hi Gordon,
this is exactly what I wanted to get.
I tried to do it through a pointer to a Session and it just did not work:

class MySender
{
 private:
   Connection  *pConn;
   Session *pSess;

 public:
   MySender() {pConn = NULL; pSess = NULL;}
   ~MySender() { if (pConn != NULL) delete pConn;}

   void Send(const char *Addr, const char *Msg)
   {if (pConn == NULL) pConn = new Connection(URL);
   
    try 
    {if (!pConn->isOpen()) pConn->open();

     if (pSess == NULL) pSess = &pConn->createSession();

     qpid::messaging::Sender sender = pSess->createSender(Addr);
  
     sender.send(Message(Msg));
    } 
     catch(const std::exception& error) 
    {std::cerr << error.what() << std::endl;
     pConn->close();
    }
   }
};

Thank you very much for showing the correct way !

Petr



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/C-client-question-tp7594654p7594673.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to