summaryrefslogtreecommitdiff
path: root/cpp/bindings/qpid/dotnet/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src')
-rw-r--r--cpp/bindings/qpid/dotnet/src/Receiver.cpp31
-rw-r--r--cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs34
2 files changed, 49 insertions, 16 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
index bbd7dd4c52..43bb7dd3cb 100644
--- a/cpp/bindings/qpid/dotnet/src/Receiver.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
@@ -344,9 +344,34 @@ namespace Messaging {
void Receiver::Close()
{
- msclr::lock lk(privateLock);
- ThrowIfDisposed();
+ System::Exception ^ newException = nullptr;
+ Message ^ newMessage = nullptr;
- nativeObjPtr->close();
+ try
+ {
+ msclr::lock lk(privateLock);
+ ThrowIfDisposed();
+
+ nativeObjPtr->close();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newMessage != nullptr)
+ {
+ delete newMessage;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
}
}}}}
diff --git a/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs b/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs
index 680732068f..a15a8d60fe 100644
--- a/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs
+++ b/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs
@@ -37,6 +37,7 @@ namespace Org.Apache.Qpid.Messaging.SessionReceiver
public interface ISessionReceiver
{
void SessionReceiver(Receiver receiver, Message message);
+ void SessionException(Exception exception);
}
@@ -67,25 +68,32 @@ namespace Org.Apache.Qpid.Messaging.SessionReceiver
{
Receiver rcvr;
Message msg;
-
- keepRunning = true;
- while (keepRunning)
+ try
{
- rcvr = session.NextReceiver(DurationConstants.SECOND);
-
- if (null != rcvr)
+ keepRunning = true;
+ while (keepRunning)
{
- if (keepRunning)
+ rcvr = session.NextReceiver(DurationConstants.SECOND);
+
+ if (null != rcvr)
{
- msg = rcvr.Fetch(DurationConstants.SECOND);
- this.callback.SessionReceiver(rcvr, msg);
+ if (keepRunning)
+ {
+ msg = rcvr.Fetch(DurationConstants.SECOND);
+ this.callback.SessionReceiver(rcvr, msg);
+ }
}
+ //else
+ // receive timed out
+ // EventEngine exits the nextReceiver() function periodically
+ // in order to test the keepRunning flag
}
- //else
- // receive timed out
- // EventEngine exits the nextReceiver() function periodically
- // in order to test the keepRunning flag
}
+ catch (Exception e)
+ {
+ this.callback.SessionException(e);
+ }
+
// Private thread is now exiting.
}