private void EndServiceDelivery(WPWithinService service, int serviceId, ServiceDeliveryToken token,
                                        int unitsReceived)
        {
            _output.WriteLine("Calling endServiceDelivery()");

            service.EndServiceDelivery(serviceId, token, unitsReceived);
        }
Esempio n. 2
0
 /// <summary>
 ///     As a consumer, this notifies the producer that service delivery should now begin.  To emulate receiving the
 ///     service, we wait for 10 seconds, the notify
 ///     the producer that all the units have been received successfully.
 /// </summary>
 /// <param name="service">The service endpoint that will communicate with the consumer.</param>
 /// <param name="serviceId">The unique identity of the service that is delivering something.</param>
 /// <param name="token">A security token that can be used to verify the authenticity of the producer.</param>
 /// <param name="unitsToSupply">The number of units that will be supplied by the service.</param>
 private void ManageServiceDelivery(WPWithinService service, int serviceId, ServiceDeliveryToken token,
                                    int unitsToSupply)
 {
     _output.WriteLine("Calling beginServiceDelivery()");
     service.BeginServiceDelivery(serviceId, token, unitsToSupply);
     _output.WriteLine("Sleeping 10 seconds..");
     Thread.Sleep(10000);
     _output.WriteLine("Calling endServiceDelivery()");
     service.EndServiceDelivery(serviceId, token, unitsToSupply);
 }
 public static ThriftServiceDeliveryToken Create(ServiceDeliveryToken serviceDeliveryToken)
 {
     return(new ThriftServiceDeliveryToken
     {
         Key = serviceDeliveryToken.Key,
         RefundOnExpiry = serviceDeliveryToken.RefundOnExpiry,
         Signature = serviceDeliveryToken.Signature,
         Expiry = serviceDeliveryToken.Expiry,
         Issued = serviceDeliveryToken.Issued
     });
 }
Esempio n. 4
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("endServiceDelivery_args");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (ServiceID != null)
         {
             field.Name = "serviceId";
             field.Type = TType.I32;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32(ServiceID.Value);
             oprot.WriteFieldEnd();
         }
         if (ServiceDeliveryToken != null)
         {
             field.Name = "serviceDeliveryToken";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             ServiceDeliveryToken.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (UnitsReceived != null)
         {
             field.Name = "unitsReceived";
             field.Type = TType.I32;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32(UnitsReceived.Value);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
Esempio n. 5
0
            public override string ToString()
            {
                StringBuilder __sb    = new StringBuilder("endServiceDelivery_args(");
                bool          __first = true;

                if (ServiceID != null)
                {
                    if (!__first)
                    {
                        __sb.Append(", ");
                    }
                    __first = false;
                    __sb.Append("ServiceID: ");
                    __sb.Append(ServiceID);
                }
                if (ServiceDeliveryToken != null)
                {
                    if (!__first)
                    {
                        __sb.Append(", ");
                    }
                    __first = false;
                    __sb.Append("ServiceDeliveryToken: ");
                    __sb.Append(ServiceDeliveryToken == null ? "<null>" : ServiceDeliveryToken.ToString());
                }
                if (UnitsReceived != null)
                {
                    if (!__first)
                    {
                        __sb.Append(", ");
                    }
                    __first = false;
                    __sb.Append("UnitsReceived: ");
                    __sb.Append(UnitsReceived);
                }
                __sb.Append(")");
                return(__sb.ToString());
            }