Beispiel #1
0
 public virtual bool onReceive(MessageEnvelope message, ITransport replyTransport)
 {
     if (message.Body.isLookupRequestSelected())
     {
         MessageEnvelope result = new MessageEnvelope();
         result.Id = message.Id;
         MessageBody body = new MessageBody();
         result.Body = body;
         LookupResult lResult = new LookupResult();
         body.selectLookupResult(lResult);
         try
         {
             lock (suppliers)
             {
                 ISupplier        supplier = suppliers[message.Body.LookupRequest.SupplierName];
                 LookupResultCode resCode  = new LookupResultCode();
                 if (supplier != null)
                 {
                     resCode.Value = LookupResultCode.EnumType.success;
                 }
                 else
                 {
                     resCode.Value = LookupResultCode.EnumType.notFound;
                 }
                 lResult.Code = resCode;
             }
             replyTransport.sendAsync(result);
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }