Spring Session for VMware GemFire
Annotation Interface EnableGemFireHttpSession
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Configuration
@Import(GemFireHttpSessionConfiguration.class)
public @interface EnableGemFireHttpSession
Add this
annotation to a Spring application defined @Configuration Class
exposing the SessionRepositoryFilter as a bean named springSessionRepositoryFilter
to back the HttpSession with either Apache Geode or Pivotal GemFire.
In order to use this annotation, a single Apache Geode / Pivotal GemFire ClientCache
or Peer Cache instance must be provided.
The most common use case is to use Apache Geode or Pivotal GemFire's client/server topology, where your
Spring Session enabled application uses a ClientCache to manage Session state in a cluster
of dedicated Apache Geode or Pivotal GemFire servers.
For example:
@ClientCacheApplication(subscriptionEnabled = true)
@EnableGemFireHttpSession(poolName = "DEFAULT"
public class ClientCacheHttpSessionConfiguration {
}
Alternatively, though less common (and not recommended), you can use Spring Session with Apache Geode
or Pivotal GemFire in the embedded Peer Cache scenario, where your Spring Session enabled application
is technically a peer in the Apache Geode or Pivotal GemFire cluster.
For example:
@PeerCacheApplication
@EnableGemFireHttpSession
public class PeerCacheHttpSessionConfiguration {
}
More advanced configurations can extend GemFireHttpSessionConfiguration instead.- Since:
- 1.1.0
- See Also:
-
AnnotationPropertiesHttpSessionCacheRegionClientCachePoolConfigurationImportEnvironmentSessionEnableSpringHttpSessionGemFireHttpSessionConfigurationSpringSessionGemFireConfigurerSessionExpirationPolicySessionSerializer
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionorg.apache.geode.cache.client.ClientRegionShortcutDefines theClientCacheRegiondata management policy.booleanDetermines whether the configuration for Spring Session using Apache Geode or Pivotal GemFire should be exposed in the SpringEnvironmentasProperties.String[]Identifies theSessionattributes by name that will be indexed for query operations.intDefines the maximum interval in seconds that aSessioncan remain inactive before it expires.Specifies the name of the specificPoolused by theClientCacheRegion(i.e.org.apache.geode.cache.RegionShortcutDefines theCacheRegiondata management policy.Defines the name of the bean referring to theSessionExpirationPolicyused to configure theSessionexpiration logic and strategy.Defines the name of the bean referring to theSessionSerializerused to serializeSessionstate between client and server or to disk when persisting or overflowingSessionstate.
-
Element Details
-
clientRegionShortcut
org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcutDefines theClientCacheRegiondata management policy. Defaults toClientRegionShortcut.PROXY. Use the spring.session.data.gemfire.cache.client.region.shortcut in Spring Boot application.properties.- Returns:
- a
ClientRegionShortcutused to configure theClientCacheRegiondata management policy. - See Also:
-
ClientRegionShortcut
- Default:
- PROXY
-
exposeConfigurationAsProperties
boolean exposeConfigurationAsPropertiesDetermines whether the configuration for Spring Session using Apache Geode or Pivotal GemFire should be exposed in the SpringEnvironmentasProperties. Currently, users may configure Spring Session for Apache Geode or Pivotal GemFire using attributes on thisAnnotation, using the well-known and documentedProperties(e.g. spring.session.data.gemfire.session.expiration.max-inactive-interval-seconds) or using theSpringSessionGemFireConfigurerdeclared as a bean in the Spring application context. ThePropertiesthat are exposed will use the well-known propertynamesthat are documented in thisAnnotation'sattributes. The values of the resultingPropertiesfollows the precedence as outlined in the documentation: first anySpringSessionGemFireConfigurerbean defined takes precedence, followed by explicitPropertiesdeclared in Spring Boot application.properties and finally, thisAnnotation'sattribute values. Defaults to false. Use spring.session.data.gemfire.session.configuration.expose in Spring Boot application.properties.- Returns:
- a boolean value indicating whether to expose the configuration of Spring Session using Apache Geode
or Pivotal GemFire in the Spring
EnvironmentasProperties.
- Default:
- false
-
indexableSessionAttributes
String[] indexableSessionAttributesIdentifies theSessionattributes by name that will be indexed for query operations. For instance, find allSessionsin Apache Geode or Pivotal GemFire having attribute A defined with value X. Defaults to emptyStringarray. Use the spring.session.data.gemfire.session.attributes.indexed in Spring Boot application.properties.- Returns:
- an array of
Stringsidentifying the names ofSessionattributes to index.
- Default:
- {}
-
maxInactiveIntervalInSeconds
int maxInactiveIntervalInSecondsDefines the maximum interval in seconds that aSessioncan remain inactive before it expires. Defaults to 1800 seconds, or 30 minutes. Use the spring.session.data.gemfire.session.expiration.max-inactive-interval-seconds in Spring Boot application.properties.- Returns:
- an integer value defining the maximum inactive interval in seconds before the
Sessionexpires.
- Default:
- 1800
-
poolName
String poolNameSpecifies the name of the specificPoolused by theClientCacheRegion(i.e. ClusteredSpringSessions) when performing cache data access operations. This is attribute is only used in the client/server topology. Defaults to gemfirePool. Use the spring.session.data.gemfire.cache.client.pool.name in Spring Boot application.properties.- Returns:
- the name of the
Poolused by theClientCacheRegionto sendSessionstate to the cluster of servers. - See Also:
- Default:
- "gemfirePool"
-
regionName
String regionNameDefines thenameof the (client)cacheRegionused to storeSessionstate. Defaults to ClusteredSpringSessions. Use the spring.session.data.gemfire.session.region.name in Spring Boot application.properties.- Returns:
- a
Stringspecifying the name of the (client)cacheRegionused to storeSessionstate. - See Also:
- Default:
- "ClusteredSpringSessions"
-
serverRegionShortcut
org.apache.geode.cache.RegionShortcut serverRegionShortcutDefines theCacheRegiondata management policy. Defaults toRegionShortcut.PARTITION. Use the spring.session.data.gemfire.cache.server.region.shortcut in Spring Boot application.properties.- Returns:
- a
RegionShortcutused to specify and configure theCacheRegiondata management policy. - See Also:
-
RegionShortcut
- Default:
- PARTITION
-
sessionExpirationPolicyBeanName
String sessionExpirationPolicyBeanNameDefines the name of the bean referring to theSessionExpirationPolicyused to configure theSessionexpiration logic and strategy. Thebeanreferred to by itsnamemust be of typeSessionExpirationPolicy. Defaults to unset. Use the spring.session.data.gemfire.session.expiration.bean-name in Spring Boot application.properties.- Returns:
- a
Stringcontaining the bean name of the configuredSessionExpirationPolicy. - See Also:
- Default:
- ""
-
sessionSerializerBeanName
String sessionSerializerBeanNameDefines the name of the bean referring to theSessionSerializerused to serializeSessionstate between client and server or to disk when persisting or overflowingSessionstate. Thebeanreferred to by itsnamemust be of typeSessionSerializer. Defaults to SessionPdxSerializer. Use the spring.session.data.gemfire.session.serializer.bean-name in Spring Boot application.properties.- Returns:
- a
Stringcontaining the bean name of the configuredSessionSerializer. - See Also:
- Default:
- "SessionPdxSerializer"
-