Example #1
0
        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();
        }
Example #2
0
 public NanoHandler(NanoSubscription <TDocument, TMessage> nanoSubscription, Func <TMessage, Task> callback)
 {
     _nanoSubscription = nanoSubscription;
     _callback         = callback;
 }