You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.3 KiB

  1. // Copyright (c) .NET Core Community. All rights reserved.
  2. // Licensed under the MIT License. See License.txt in the project root for license information.
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading;
  6. using DotNetCore.CAP.Messages;
  7. using JetBrains.Annotations;
  8. namespace DotNetCore.CAP.Transport
  9. {
  10. /// <inheritdoc />
  11. /// <summary>
  12. /// Message queue consumer client
  13. /// </summary>
  14. public interface IConsumerClient : IDisposable
  15. {
  16. BrokerAddress BrokerAddress { get; }
  17. /// <summary>
  18. /// Subscribe to a set of topics to the message queue
  19. /// </summary>
  20. /// <param name="topics"></param>
  21. void Subscribe(IEnumerable<string> topics);
  22. /// <summary>
  23. /// Start listening
  24. /// </summary>
  25. void Listening(TimeSpan timeout, CancellationToken cancellationToken);
  26. /// <summary>
  27. /// Manual submit message offset when the message consumption is complete
  28. /// </summary>
  29. void Commit([NotNull] object sender);
  30. /// <summary>
  31. /// Reject message and resumption
  32. /// </summary>
  33. void Reject([CanBeNull] object sender);
  34. event EventHandler<TransportMessage> OnMessageReceived;
  35. event EventHandler<LogMessageEventArgs> OnLog;
  36. }
  37. }