Merged
fix for: https://issues.apache.org/jira/browse/AMQNET-314
fix for: https://issues.apache.org/jira/browse/AMQNET-313
diff --git a/src/main/csharp/MessageConsumer.cs b/src/main/csharp/MessageConsumer.cs
index 27c8b2f..0d0885e 100755
--- a/src/main/csharp/MessageConsumer.cs
+++ b/src/main/csharp/MessageConsumer.cs
@@ -55,8 +55,8 @@
private bool inProgressClearRequiredFlag;
private event MessageListener listener;
-
private IRedeliveryPolicy redeliveryPolicy;
+ private Exception failureError;
// Constructor internal to prevent clients from creating an instance.
internal MessageConsumer(Session session, ConsumerInfo info)
@@ -534,7 +534,14 @@
}
else
{
- return null;
+ if(this.failureError != null)
+ {
+ throw NMSExceptionSupport.Create(FailureError);
+ }
+ else
+ {
+ return null;
+ }
}
}
else if(dispatch.Message == null)
@@ -878,10 +885,16 @@
{
if(this.listener != null)
{
- throw new NMSException("Cannot set Async listeners on Consumers with a prefetch limit of zero");
+ throw new NMSException("Cannot perform a Synchronous Receive when there is a registered asynchronous listener.");
}
}
+ public Exception FailureError
+ {
+ get { return this.failureError; }
+ set { this.failureError = value; }
+ }
+
#region Nested ISyncronization Types
class MessageConsumerSynchronization : ISynchronization
diff --git a/src/main/csharp/Session.cs b/src/main/csharp/Session.cs
index 6770283..63ed02d 100755
--- a/src/main/csharp/Session.cs
+++ b/src/main/csharp/Session.cs
@@ -303,6 +303,7 @@
{
foreach(MessageConsumer consumer in consumers.Values)
{
+ consumer.FailureError = this.connection.FirstFailureError;
consumer.DoClose();
}
}