This is an automated email from the ASF dual-hosted git repository.
havret pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-api.git
The following commit(s) were added to refs/heads/main by this push:
new 9b1295c AMQNET-735 Add AsyncMessageListener to Consumer API
new b6ca670 Merge pull request #26 from Havret/add_async_consumer
9b1295c is described below
commit 9b1295cb7c5210c2fb3a0805350310e3aadcd425
Author: Havret <[email protected]>
AuthorDate: Tue Sep 21 22:36:38 2021 +0200
AMQNET-735 Add AsyncMessageListener to Consumer API
---
src/nms-api/IMessageConsumer.cs | 15 +++++++++++++--
src/nms-api/INMSConsumer.cs | 7 ++++++-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/nms-api/IMessageConsumer.cs b/src/nms-api/IMessageConsumer.cs
index 95a3780..c2db8d9 100644
--- a/src/nms-api/IMessageConsumer.cs
+++ b/src/nms-api/IMessageConsumer.cs
@@ -15,14 +15,20 @@
* limitations under the License.
*/
+using System.Threading;
using System.Threading.Tasks;
namespace Apache.NMS
{
/// <summary>
- /// A delegate that can receive messages async.
+ /// A delegate that can receive messages.
/// </summary>
public delegate void MessageListener(IMessage message);
+
+ /// <summary>
+ /// A delegate that can receive messages asynchronously.
+ /// </summary>
+ public delegate Task AsyncMessageListener(IMessage message,
CancellationToken cancellationToken);
/// <summary>
/// A delegate that a client can register that will be called each time a
consumer dispatches a message
@@ -69,10 +75,15 @@ namespace Apache.NMS
IMessage ReceiveNoWait();
/// <summary>
- /// An asynchronous listener which can be used to consume messages
asynchronously
+ /// An listener which can be used to consume messages
/// </summary>
event MessageListener Listener;
+ /// <summary>
+ /// An asynchronous listener which can be used to consume messages
asynchronously
+ /// </summary>
+ event AsyncMessageListener AsyncListener;
+
/// <summary>
/// Closes the message consumer.
/// </summary>
diff --git a/src/nms-api/INMSConsumer.cs b/src/nms-api/INMSConsumer.cs
index 89f3ed6..1b3f800 100644
--- a/src/nms-api/INMSConsumer.cs
+++ b/src/nms-api/INMSConsumer.cs
@@ -68,9 +68,14 @@ namespace Apache.NMS
string MessageSelector { get; }
/// <summary>
- /// An asynchronous listener which can be used to consume messages
asynchronously
+ /// A listener which can be used to consume messages
/// </summary>
event MessageListener Listener;
+
+ /// <summary>
+ /// An asynchronous listener which can be used to consume messages
asynchronously
+ /// </summary>
+ event AsyncMessageListener AsyncListener;
/// <summary>
/// Closes the message consumer.