Summary: Allows you to run a Processing Unit within an embedded environment.
OverviewThe integrated Processing Unit container allows you to run a Processing Unit within an embedded environment. The definition of an embedded environemnt is an environment that provides the classpath for the Processing Unit to run under. Examples of such an environment can be an IDE, integration tests, and any other Java hosted environment. The integrated Processing Unit container is built around Spring ApplicationContext with several extensions such as Cluster Info and Bean Level Properties. The integrated Processing Unit can be run using the main() method, and can be created using a ProcessingUnitContainerProvider. IntegratedProcessingUnitContainerProviderThe integrated Processing Unit container can be created programmatically using the IntegratedProcessingUnitContainerProvider. This is very useful when writing integration tests (though Spring's own mock library can also be used for testing using pure Spring application context). Here is an example of using a ProcessingUnitContainerProvider in order to create one: IntegratedProcessingUnitContainerProvider provider = new IntegratedProcessingUnitContainerProvider(); // provide cluster information for the specific PU instance ClusterInfo clusterInfo = new ClusterInfo(); clusterInfo.setSchema("partitioned"); clusterInfo.setNumberOfInstances(2); clusterInfo.setInstanceId(1); provider.setClusterInfo(clusterInfo); // set the config location (override the default one - classpath:/META-INF/spring/pu.xml) provider.addConfigLocation("classpath:/test/my-pu.xml"); // Build the Spring application context and "start" it IntegratedProcessingUnitContainer container = provider.createContainer(); // ... container.close(); Note that in this example, it is assumed that different classpath settings are already set when running the code, including third-party libraries. Executable IntegratedProcessingUnitContainerThe IntegratedProcessingUnitContainer provides an executable main() method, allowing you to run it directly. The main() method uses the IntegratedProcessingUnitContainerProvider and command-line conventions in order to create the IntegratedProcessingUnitContainer. The following is a list of all the possible command-line parameters available:
Using IntegratedProcessingUnitContainer in the IDEOne main usage of the IntegratedProcessingUnitContainer is to execute a Processing Unit in the IDE. Here is a screenshot of Eclipse configured with the OpenSpaces data example: The following screenshot displays the Create, manage, and run configurations Eclipse dialog for executing the data processor: In the screenshot above, we run the data processor module using the integrated Processing Unit container from within the IDE. There are no arguments provided in this execution, causing the integrated Processing Unit container to use its sensible defaults. Since our project is structured in a way that META-INF/spring/pu.xml exists inside our source directory, it is automatically used as the Spring configuration context (it is part of the processor module classpath). Our data processor module also has all the required libraries in its project definition (such as openspaces.jar, JSpaces.jar, commons-logging.jar and spring.jar), so the integrated Processing Unit container is run with these libraries. The following screenshot shows how to run a data processor instance with a partitioned cluster schema and ID 1, and the arguments provided in the configuration: |
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |