public static async Task <Guid> CheckoutTest(List <CustomerOrderItem> cart) { // you may want to create a guid and an actor from that guid Guid orderId = new Guid(); ICustomerOrderActor customerOrder = ActorProxy.Create <ICustomerOrderActor>(new ActorId(orderId), applicationName); Console.WriteLine("Trying to get initial status of actor..."); await GetOrderStatus(orderId); Console.WriteLine("Theoretically we have created a functioning customerOrder actor"); // Create actor proxy and send the request try { await customerOrder.SubmitOrderAsync(cart); } catch (InvalidOperationException ex) { Console.WriteLine(string.Format("CustomerOrderTestApp Service: Actor rejected {0}: {1}", customerOrder, ex)); throw; } catch (Exception ex) { Console.WriteLine(string.Format("CustomerOrderTestApp: Exception {0}: {1}", customerOrder, ex)); throw; } return(orderId); }
public async Task <Guid> PostCheckout(string orderId) { ServiceEventSource.Current.Message("Now printing cart for POSTCHECKOUT..."); Guid orderIdGuid = Guid.Parse(orderId); ServiceUriBuilder builder = new ServiceUriBuilder(CustomerOrderServiceName); //We create a unique Guid that is associated with a customer order, as well as with the actor that represents that order's state. ICustomerOrderActor customerOrder = ActorProxy.Create <ICustomerOrderActor>(new ActorId(orderIdGuid), builder.ToUri()); try { await customerOrder.SubmitOrderAsync(); ServiceEventSource.Current.Message("Customer order submitted successfully. ActorOrderID: {0} created", orderId); } catch (InvalidOperationException ex) { ServiceEventSource.Current.Message("Web Service: Actor rejected {0}: {1}", customerOrder, ex); throw; } catch (Exception ex) { ServiceEventSource.Current.Message("Web Service: Exception {0}: {1}", customerOrder, ex); throw; } return(orderIdGuid); }