C# 클래스 CustomerOrder.Actor.CustomerOrderActor

상속: Actor, ICustomerOrderActor, IRemindable
파일 보기 프로젝트 열기: Azure-Samples/service-fabric-dotnet-web-reference-app 1 사용 예제들

공개 메소드들

메소드 설명
CustomerOrderActor ( ActorService actorService, ActorId actorId ) : Common
GetOrderStatusAsStringAsync ( ) : Task

Returns the status of the Customer Order.

InternalActivateAsync ( ICodePackageActivationContext context, IServiceProxyFactory proxyFactory ) : Task

Adding this method to support DI/Testing We need to do some work to create the actor object and make sure it is constructed completely In local testing we can inject the components we need, but in a real cluster those items are not established until the actor object is activated. Thus we need to have this method so that the tests can have the same init path as the actor would in prod

ReceiveReminderAsync ( string reminderName, byte context, System.TimeSpan dueTime, System.TimeSpan period ) : Task
SubmitOrderAsync ( IEnumerable orderList ) : Task

This method accepts a list of CustomerOrderItems, representing a customer order, and sets the actor's state to reflect the status and contents of the order. Then, the order is fulfilled with a private FulfillOrder call that abstracts away the entire backorder process from the user.

보호된 메소드들

메소드 설명
OnActivateAsync ( ) : Task

Initializes CustomerOrderActor state. Because an order actor will only be activated once in this scenario and never used again, when we initiate the actor's state we change the order's status to "Confirmed," and do not need to check if the actor's state was already set to this.

OnDeactivateAsync ( ) : Task

Deactivates the actor object

비공개 메소드들

메소드 설명
FulfillOrderAsync ( ) : Task

This method takes in a list of CustomerOrderItem objects. Using a Service Proxy to access the Inventory Service, the method iterates onces through the order and tries to remove the quantity specified in the order from inventory. If the inventory has insufficient stock to remove the requested amount for a particular item, the entire order is marked as backordered and the item in question is added to a "backordered" item list, which is fulfilled in a separate method. In its current form, this application addresses the question of race conditions to remove the same item by making a rule that no order ever fails. While an item that is displayed in the store may not be available any longer by the time an order is placed, the automatic restock policy instituted in the Inventory Service means that our FulfillOrder method and its sub-methods can continue to query the Inventory Service on repeat (with a timer in between each cycle) until the order is fulfilled.

GetOrderStatusAsync ( ) : Task
SetOrderStatusAsync ( CustomerOrderStatus orderStatus ) : Task

메소드 상세

CustomerOrderActor() 공개 메소드

public CustomerOrderActor ( ActorService actorService, ActorId actorId ) : Common
actorService ActorService
actorId ActorId
리턴 Common

GetOrderStatusAsStringAsync() 공개 메소드

Returns the status of the Customer Order.
public GetOrderStatusAsStringAsync ( ) : Task
리턴 Task

InternalActivateAsync() 공개 메소드

Adding this method to support DI/Testing We need to do some work to create the actor object and make sure it is constructed completely In local testing we can inject the components we need, but in a real cluster those items are not established until the actor object is activated. Thus we need to have this method so that the tests can have the same init path as the actor would in prod
public InternalActivateAsync ( ICodePackageActivationContext context, IServiceProxyFactory proxyFactory ) : Task
context ICodePackageActivationContext
proxyFactory IServiceProxyFactory
리턴 Task

OnActivateAsync() 보호된 메소드

Initializes CustomerOrderActor state. Because an order actor will only be activated once in this scenario and never used again, when we initiate the actor's state we change the order's status to "Confirmed," and do not need to check if the actor's state was already set to this.
protected OnActivateAsync ( ) : Task
리턴 Task

OnDeactivateAsync() 보호된 메소드

Deactivates the actor object
protected OnDeactivateAsync ( ) : Task
리턴 Task

ReceiveReminderAsync() 공개 메소드

public ReceiveReminderAsync ( string reminderName, byte context, System.TimeSpan dueTime, System.TimeSpan period ) : Task
reminderName string
context byte
dueTime System.TimeSpan
period System.TimeSpan
리턴 Task

SubmitOrderAsync() 공개 메소드

This method accepts a list of CustomerOrderItems, representing a customer order, and sets the actor's state to reflect the status and contents of the order. Then, the order is fulfilled with a private FulfillOrder call that abstracts away the entire backorder process from the user.
public SubmitOrderAsync ( IEnumerable orderList ) : Task
orderList IEnumerable
리턴 Task