private INanoSubscription CreateSubscription <TMessage>(NanoSubsciptionKey subscriptionKey) where TMessage : IDomainMessage <TDocument> { if (_messageTypeMap.TryAdd(typeof(TMessage).FullName, typeof(TMessage))) { var subscription = new NanoSubscription <TDocument, TMessage>(); var nanoMessage = NanoMessage.CreateSubscribeMessage <TDocument, TMessage>(NanoBusClient.ClientId, subscriptionKey.NanoDocumentId); EnqueueMessage(nanoMessage); return(subscription); } ; throw new InvalidOperationException(); }
public NanoHandler(NanoSubscription <TDocument, TMessage> nanoSubscription, Func <TMessage, Task> callback) { _nanoSubscription = nanoSubscription; _callback = callback; }