You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by "634749030@qq.com" <63...@qq.com> on 2016/09/12 12:41:42 UTC
qpid session thread safe
HI!
Now I use the c++ API for version 0.34, but I have some questions about
session;
I create one receive and one sender by the same session,so is it thread
safe to send message and fetch message in different thread?
example code:
int main()
{
Connection connection(broker, options);
connection.open();
Session session = connection.createSession();
Receiver receiver = session.createReceiver(address);
Sender sender = session.createSender(address);
return 1;
}
int SendThread() // send thread
{
while(true)
{
sender.send(Message("Hello world!"));
}
}
int RecvProc() // recv thread
{
while(true)
{
Message message = receiver.fetch(Duration::SECOND);
}
}
--
View this message in context: http://qpid.2158936.n2.nabble.com/qpid-session-thread-safe-tp7650570.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: qpid session thread safe
Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/16 13:41, 634749030@qq.com wrote:
> HI!
> Now I use the c++ API for version 0.34, but I have some questions about
> session;
> I create one receive and one sender by the same session,so is it thread
> safe to send message and fetch message in different thread?
Yes.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org