@EnableBinding(value=org.springframework.cloud.stream.messaging.Source.class)
@Import(value={KeyInterestConfiguration.class,GemfirePoolConfiguration.class,GemfireClientRegionConfiguration.class})
@EnableConfigurationProperties(value=GemfireSourceProperties.class)
@PropertySource(value="classpath:gemfire-source.properties")
public class GemfireSourceConfiguration
extends Object
The Gemfire Source provides a CacheListeningMessageProducer
which produces a
message for cache events. Internally it uses a CacheListener
which, by default, emits a native GemFire type which holds all of the event details.
This is not ideal for streaming applications because it require this type to
be also in the consuming app's classpath. Hence, a SpEl Expression, given by the
property 'cacheEventExpression' is used to extract required information from the
payload. The default expression is 'newValue' which returns the updated object. This
may not be ideal for every use case especially if it does not provide the key
value. The key is referenced by the field 'key'. Also available are 'operation' (the
operation associated with the event, and 'oldValue'. If the cached key and value
types are primitives, an simple expression like "key + ':' + newValue" may work.
More complex transformations, such as Json, will require customization. To access
the original object, set 'cacheEntryExpression' to '#root' or "#this'.
This converts payloads of type PdxInstance
, which Gemfire uses to store
JSON content (the type of newValue for instance), to a JSON String.
- Author:
- David Turanski