Applied patch from Stephane Ramet to implement QueueBrowser. Thanks Stephane!
Fixes [AMQNET-517]. (See https://issues.apache.org/jira/browse/AMQNET-517)
diff --git a/src/main/csharp/QueueBrowser.cs b/src/main/csharp/QueueBrowser.cs
index 37d8172..3423f20 100644
--- a/src/main/csharp/QueueBrowser.cs
+++ b/src/main/csharp/QueueBrowser.cs
@@ -107,12 +107,37 @@
get { return EMSConvert.ToNMSQueue(this.tibcoQueueBrowser.Queue); }
}
+ internal class Enumerator : IEnumerator
+ {
+ private IEnumerator innerEnumerator;
+
+ public Enumerator(IEnumerator innerEnumerator)
+ {
+ this.innerEnumerator = innerEnumerator;
+ }
+
+ public object Current
+ {
+ get
+ {
+ return EMSConvert.ToNMSMessage((TIBCO.EMS.Message)this.innerEnumerator.Current);
+ }
+ }
+
+ public bool MoveNext()
+ {
+ return this.innerEnumerator.MoveNext();
+ }
+
+ public void Reset()
+ {
+ this.innerEnumerator.Reset();
+ }
+ }
+
public IEnumerator GetEnumerator()
{
- // TODO: This enumerator will need to be adapted. As it is now, the low-level EMS
- // objects will be enumerated. We need to wrap these objects into the NMS interface
- // types to fit into the provider agnostic system.
- return this.tibcoQueueBrowser.GetEnumerator();
+ return new Enumerator(this.tibcoQueueBrowser.GetEnumerator());
}
}
}