Summary: How to create and deploy a custom processing unit
OverviewThe .NET Processing Unit Container is based on the OpenSpaces Processing Unit, and allows you to write a .NET component that can be managed by the service grid. The Processing Unit Container is aware of the cluster info. This allows you to write your code decoupled from cluster topologies considerations.
AbstractProcessingUnitContainer classThe AbstractProcessingUnitContainer class implements IDisposable, and consists of one additional method and two properties: public abstract class AbstractProcessingUnitContainer { // Cluster information is set into this property at deploy-time. ClusterInfo ClusterInfo { get; set; } // Properties are set into this properties at deploy-time. IDictionary<String, String> Properties { get; set; } // Invoked by the Service Grid to initialize the processing unit container. virtual void Initialize(); // Invoked by the Service Grid to terminate the processing unit container. virtual void Dispose(); } The Processing Unit Container lifecycle consists only of these two methods: Initialize is called when the Processing Unit Container is constructed, and Dispose is called when it is removed. Before the initialization, the ClusterInfo and Properties are set with the deploy-time data. ClusterInfoOne of the core ideas of the Processing Unit is the determination of the deployment topology in deploy-time. Therefore, when building a Processing Unit, there is almost no need to be aware of the actual cluster topology the Processing Unit is deployed under.
The ClusterInfo class holds the following information:
Creating Your Own Processing Unit ContainerStep 1 – Create the Processing Unit ContainerA processing unit container is an extension of the GigaSpaces.XAP.ProcessingUnit.Containers.AbstractProcesingUnitContainer class, which is deployed and executed inside the Service Grid. You need to create your own library with your own extension of the GigaSpaces.XAP.ProcessingUnit.Containers.AbstractProcesingUnitContainer class. Step 2 – Create a Deployment pu.config FileYou need a config file, which is used to deploy the Processing Unit Container. This config file must be named pu.config and needs to be placed together with your processing unit container implementation assemblies. Step 3 – Configure the Deployment pu.config FileThe pu.config you've created needs to be edited to point to your Processing Unit Container implementation. The file should contain the following data:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="GigaSpaces.XAP" type="GigaSpaces.XAP.Configuration.GigaSpacesXAPConfiguration, GigaSpaces.Core"/> </configSections> <appSettings> <add key="[customkey1]" value="[customvalue1]"/> </appSettings> <GigaSpaces.XAP> <ProcessingUnitContainer Type="[Assembly Qualified Name]"/> </GigaSpaces.XAP> </configuration>
SLA DefinitionIn order to define the service layer agreement of your processing unit, an SLA file needs to be created.
DeploymentThere are several ways to deploy the Processing Unit Container into the Service Grid. Are all detailed extensively in the .NET Processing Unit Data Example section. The most straightforward way is to use the GigaSpaces Management Center for deployment. |
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |