コード例 #1
0
 public IPublish <T> WithConfirm(Func <BasicAckEventArgs, Task> onAck, Func <BasicNackEventArgs, Task> onNack)
 {
     if (onAck == null ||  onNack == null)
     {
         throw DeclarationException.Argument(new ArgumentException("handlers for ack and nack must not be null"));
     }
     _useConfirm   = true;
     _ackCallback  = onAck;
     _nackCallback = onNack;
     return(this);
 }
コード例 #2
0
 public DeclareResponder(IBunny bunny, string rpcExchange, string fromQueue, Func <TRequest, Task <TResponse> > respond)
 {
     if (respond == null)
     {
         throw DeclarationException.Argument(new ArgumentException("respond delegate must not be null"));
     }
     _bunny            = bunny;
     _respond          = respond;
     _rpcExchange      = rpcExchange;
     _serialize        = Config.Serialize;
     _consumeFromQueue = fromQueue;
     _thisChannel      = new PermanentChannel(bunny);
     _deserialize      = Config.Deserialize <TRequest>;
 }
コード例 #3
0
 private static IBunny CheckGetBunny(IDeclare declare, string toCheck, string errorPrefix)
 {
     if (string.IsNullOrWhiteSpace(toCheck))
     {
         var arg = new ArgumentException($"{errorPrefix}-name must not be null-or-whitespace");
         throw DeclarationException.Argument(arg);
     }
     if (toCheck.Length > 255)
     {
         var arg = new ArgumentException($"{errorPrefix}-length must be less than or equal to 255 character");
         throw DeclarationException.Argument(arg);
     }
     return(declare.Bunny);
 }