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.cpp109
1 files changed, 73 insertions, 36 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
index ea612861e5..4c9062866d 100644
--- a/cpp/bindings/qpid/dotnet/src/Receiver.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
@@ -121,24 +121,43 @@ namespace Messaging {
//
// Get(message)
//
- // TBD
- //bool Receiver::Get(Message ^ mmsgp)
- //{
- // return Get(mmsgp, DurationConstants::FORVER);
- //}
- //
- //bool Receiver::Get(Message ^ mmsgp, Duration ^ durationp)
- //{
- // ::qpid::messaging::Duration dur((*durationp).Milliseconds);
- //
- // ::qpid::messaging::Message tmpMsg;
- //
- // bool result = receiverp->Receiver::get(tmpMsg, dur);
- //
- // mmsgp = gcnew Message(tmpMsg);
- //
- // return result;
- //}
+ bool Receiver::Get(Message ^% mmsgp)
+ {
+ return Get(mmsgp, DurationConstants::FORVER);
+ }
+
+ bool Receiver::Get(Message ^% mmsgp, Duration ^ durationp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::messaging::Duration dur((*durationp).Milliseconds);
+
+ ::qpid::messaging::Message tmpMsg;
+
+ bool result = receiverp->Receiver::get(tmpMsg, dur);
+
+ if (result)
+ {
+ mmsgp = gcnew Message(tmpMsg);
+ }
+
+ return result;
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return false;
+ }
//
// message = Get()
@@ -192,24 +211,42 @@ namespace Messaging {
//
// Fetch(message)
//
- // TBD
- //bool Receiver::Fetch(Message ^ mmsgp)
- //{
- // return Fetch(mmsgp, DurationConstants::FORVER);
- //}
- //
- //bool Receiver::Fetch(Message ^ mmsgp, Duration ^ durationp)
- //{
- // ::qpid::messaging::Duration dur((*durationp).Milliseconds);
- //
- // ::qpid::messaging::Message tmpMsg;
- //
- // bool result = receiverp->Receiver::fetch(tmpMsg, dur);
- //
- // mmsgp = gcnew Message(tmpMsg);
- //
- // return result;
- //}
+ bool Receiver::Fetch(Message ^% mmsgp)
+ {
+ return Fetch(mmsgp, DurationConstants::FORVER);
+ }
+
+ bool Receiver::Fetch(Message ^% mmsgp, Duration ^ durationp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::messaging::Duration dur((*durationp).Milliseconds);
+
+ ::qpid::messaging::Message tmpMsg;
+
+ bool result = receiverp->Receiver::fetch(tmpMsg, dur);
+
+ if (result)
+ {
+ mmsgp = gcnew Message(tmpMsg);
+ }
+
+ return result;
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return false;
+ }
//