public IHandleMessagesWithLocksBuilder HandleRequestAsync <TRequest, TReply>(Func <IOperationContext, TRequest, Task <TReply> > handler, LockType lockType = LockType.Write) where TRequest : Message where TReply : Message { _handlerByType[typeof(TRequest)] = new LockedOperationDesc(async(operation) => await handler(operation, operation.Message as TRequest), lockType); return(this); }
public IHandleMessagesWithLocksBuilder HandleMessage <TRequest>(Action <IOperationContext, TRequest> handler, LockType lockType = LockType.Write) where TRequest : Message { _handlerByType[typeof(TRequest)] = new LockedOperationDesc((operation) => { handler(operation, operation.Message as TRequest); return(Task.FromResult <Message>(null)); }, lockType); return(this); }
public IHandleMessagesWithLocksBuilder HandleRequest <TRequest>(Func <IOperationContext, TRequest, Message> handler, LockType lockType = LockType.Write) where TRequest : Message { _handlerByType[typeof(TRequest)] = new LockedOperationDesc((operation) => { var msg = handler(operation, operation.Message as TRequest); return(Task.FromResult(msg)); }, lockType); return(this); }