You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by joseluis <jl...@gmail.com> on 2012/02/02 19:42:20 UTC
is it possible to reactivate a session with errors?
Hi,
After trying to connect to a non existing address, it's not possible to use
the Session
qpid::messaging::Connection connection("amqp:tcp:127.0.0.1:5672");
connection.open();
qpid::messaging::Session session =
connection.createSession("pr");
qpid::messaging::Receiver receiver =
session.createReceiver("testing/#");
qpid::messaging::Sender sender =
session.createSender("testing/pr");
try
{
qpid::messaging::Receiver receiver2 =
session.createReceiver("NON_EXISTS/#");
}
catch(...)
{
std::cout << "error" << std::endl;
}
qpid::messaging::Message msg("hello");
// trying to send a message, throws an exception
sender.send(msg);
To continue working with the session and the sender, it's necessary to
create again the session and the sender...
try
{
qpid::messaging::Receiver receiver2 =
session.createReceiver("NON_EXISTS/#");
}
catch(...)
{
session..close();
session = connection.createSession("pr");
sender = session.createSender("testing/pr");
}
qpid::messaging::Message msg("hello");
// now works
sender.send(msg);
Is it OK?
Is there a different way to manage this situation?
kind regards
--
View this message in context: http://qpid.2158936.n2.nabble.com/is-it-possible-to-reactivate-a-session-with-errors-tp7247997p7247997.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org