summaryrefslogtreecommitdiff
path: root/cpp/bindings/qpid/dotnet/src/Receiver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src/Receiver.cpp')
-rw-r--r--cpp/bindings/qpid/dotnet/src/Receiver.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
index 5dbc83dcbf..2d6b2f56c3 100644
--- a/cpp/bindings/qpid/dotnet/src/Receiver.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
@@ -29,6 +29,7 @@
#include "qpid/messaging/exceptions.h"
#include "Receiver.h"
+#include "Address.h"
#include "Session.h"
#include "Message.h"
#include "Duration.h"
@@ -374,4 +375,44 @@ namespace Messaging {
throw newException;
}
}
+
+ Org::Apache::Qpid::Messaging::Address ^ Receiver::GetAddress()
+ {
+ msclr::lock lk(privateLock);
+ ThrowIfDisposed();
+
+ System::Exception ^ newException = nullptr;
+ Messaging::Address ^ newAddress = nullptr;
+
+ try
+ {
+ // fetch unmanaged Address
+ ::qpid::messaging::Address addr =
+ nativeObjPtr->getAddress();
+
+ // create a managed Address
+ newAddress = gcnew Address(addr);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newAddress != nullptr)
+ {
+ delete newAddress;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newAddress;
+ }
}}}}