Summary: This section describes how you can use OpenSpaces components in a non-Spring environment. The constructs which are used to create and configure GigaSpaces components are called
Configurers .
Overview
You can always "imitate" Spring, and call the OpenSpaces Spring FactoryBeans from your own code, but that's not very clean, and requires you to dig through the OpenSpaces code to understand how Spring and OpenSpaces work. OpenSpaces for Non-Spring UsersSince version 6.0.2, you have the option of programmatically creating GigaSpaces components, as opposed to creating them declaratively in your Spring XML configuration. This is also very useful if you're using code-based configuration frameworks to configure your application such as Google Guice or Spring JavaConfig. Some HistoryUp until version 6.0, the preferred API to use GigaSpaces was JavaSpaces with some proprietary extensions. In 6.0 we introduced OpenSpaces framework, which greatly simplified things and made the user experience much more positive by abstracting away a lot of the API problems and inconsistencies. From day one, OpenSpaces has been tightly coupled with Spring. It uses Spring for configuration, and utilizes a lot of goodies that Spring provides, such as Spring's transaction management framework, namespace-based configuration, AOP and more. However, since OpenSpaces' goal is become the preferred Java API for the product, the fact that you could only use it through Spring was a bit limiting to some of our users. Introducing ConfigurersBelow are a number of code snippets to show you how this is done. Let's first show the Spring equivalent of creating a space instance, and then wiring your listener on top of it, using a polling container: <os-core:space id="space" url="/./space" /> <os-core:giga-space id="gigaSpace" space="space"/> <bean id="simpleListener" class="SimpleListener" /> <os-events:polling-container id="eventContainer" giga-space="gigaSpace"> <os-core:template> <bean class="org.openspaces.example.data.common.Data"> <property name="processed" value="false"/> </bean> </os-core:template> <os-events:listener> <os-events:annotation-adapter> <os-events:delegate ref="simpleListener"/> </os-events:annotation-adapter> </os-events:listener> </os-events:polling-container>
Here's how this is done in Java code, via configurers: //creating a space IJSpace space = new UrlSpaceConfigurer("/./space").space(); //wrapping it with a GigaSpace GigaSpace gigaSpace = new GigaSpaceConfigurer(space).gigaSpace(); //creating polling container Data template = new Data(); template.setProcessed(false); SimplePollingEventListenerContainer pollingEventListenerContainer = new SimplePollingContainerConfigurer(gigaSpace) .template(template) .eventListenerAnnotation(new SimpleListener()) .pollingContainer();
Additional Notes
Where is this Documented?Every OpenSpaces documentation page includes code snippets that show how to configure it. The configuration is displayed in a tabbed pane, which typically includes the following tabs:
|
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |