This solution illustrates how to implement an Invocation Grid (IG) project that can be launched by the ScaleOut StateServer service.
Several advanced ScaleOut features take advantage of server-side events for fast, local processing of ScaleOut objects. ScaleOut's Invocation Grid hosting model allows you to deploy and host event-handling code in a .NET worker process that is managed by the ScaleOut service.
This sample solution consists of three projects:
-
ShoppingCartIG: An Invocation Grid worker project, based on the igworker project template that is available in the Scaleout.Templates NuGet package. This example worker hosts a PMI Reduce operation that analyzes shopping carts stored in the ScaleOut service.
-
ShoppingCart: A class library containing the
Cart
data transfer object (DTO) class and supporting types, which are stored in the ScaleOut service. -
Client: A command-line client program that loads the ScaleOut service with shopping cart objects and illustrates how to execute a PMI invoke operation against the Invocation Grid.
- One or more hosts running the ScaleOut service using a ScaleOut StateServer® Pro or ScaleOut StreamServer® license
- .NET 5.0 SDK
-
Install the ScaleOut IG command-line utility. This .NET tool simplifies the packaging and deployment of IG worker projects.
dotnet tool install -g Scaleout.InvocationGrid.Cli
-
Open a command prompt in the ShoppingCartIG project directory and run:
ig start -c "bootstrapGateways=localhost:721"
Modify the connection string to specify the address and port used by one of your ScaleOut host systems.
This command will build, package, and upload the ShoppingCartIG project to the ScaleOut servers in your cluster. The ScaleOut hosts will then decompress the package to a local temporary directory and start the worker process.
Tip: Run
ig start --help
for a list of IG startup options. -
Run the Client application. This will add shopping cart objects to the ScaleOut service and then invoke the IG worker's "TotalBackorderedValue" operation.
If the client's
Cache.Invoke
call throws aNotReadyException
, this indicates that the IG worker process has not been started on the ScaleOut hosts. Run theig start
command from step 2 above to start the IG worker process.