IPubSub.cs 704 B

12345678910111213141516171819
  1. using Apache.NMS;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace EasyMQ
  8. {
  9. public delegate void OnMessageHandle(ref byte value, uint byteslength,Dictionary<string,object> properties);
  10. public interface IPubSub
  11. {
  12. Task PublishAsync<T>(T message,Dictionary<string,string>? properties =null);
  13. Task PublishAsync(string topicname,ref byte message, UInt32 byteslength, Dictionary<string, string>? properties = null);
  14. void Subscribe<T>(Action<T, IPrimitiveMap> onMessage, string selector ="");
  15. void Subscribe(string topicname, OnMessageHandle onMessage, string selector = "");
  16. }
  17. }