public class SimpleNotifyEventListenerContainer extends AbstractEventListenerContainer
SpaceDataEventListener
that will be triggered by notifications. Uses
SimpleNotifyEventListenerContainer
for configuration of different notification
registration parameters and transactional semantics.
The container can automatically take the notified event data (using GigaSpace.take(Object)
) if the setPerformTakeOnNotify(boolean)
is set to
true
. Defaults to false
. If the flag is set to true
,
setIgnoreEventOnNullTake(boolean)
can control of the event will be propagated to the
event listener if the take operation returned null.
Modifier and Type | Field and Description |
---|---|
protected static org.springframework.core.Constants |
constants |
beanName, disableTransactionValidation, exceptionHandler, logger, snapshotTemplateThreadLocal
Constructor and Description |
---|
SimpleNotifyEventListenerContainer() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeSession() |
protected EventSessionConfig |
createEventSessionConfig()
Creates a new
EventSessionConfig based on the different
parameters this container accepts. |
protected void |
doAfterStart() |
protected void |
doBeforeStop() |
protected void |
doInitialize()
A callback to perform custom initialization steps.
|
protected void |
doShutdown()
Perform any custom shutdown operations.
|
protected void |
dump(PrintWriter writer) |
protected Integer |
getBatchPendingThreshold() |
protected Integer |
getBatchSize() |
protected Integer |
getBatchTime() |
protected String |
getEventListenerContainerType() |
String |
getName() |
protected Boolean |
getNotifyLeaseExpire() |
protected Boolean |
getNotifyMatchedUpdate() |
protected Boolean |
getNotifyRematchedUpdate() |
protected Boolean |
getNotifyTake() |
protected Boolean |
getNotifyUnmatched() |
protected Boolean |
getNotifyUpdate() |
protected Boolean |
getNotifyWrite() |
protected long |
getRenewDuration()
Deprecated.
Since 9.7
|
protected long |
getRenewExpiration()
Deprecated.
Since 9.7
|
protected long |
getRenewRTT()
Deprecated.
Since 9.7
|
ServiceDetails[] |
getServicesDetails()
Retruns one or more service details that the service exposes.
|
ServiceMonitors[] |
getServicesMonitors()
Retruns one or more service details that the service exposes.
|
protected String |
getTag() |
void |
initialize()
Initialize this container.
|
protected void |
invokeListenerWithTransaction(BatchRemoteEvent batchRemoteEvent,
boolean performTakeOnNotify,
boolean ignoreEventOnNullTake) |
protected void |
invokeListenerWithTransaction(Object eventData,
Object source,
boolean performTakeOnNotify,
boolean ignoreEventOnNullTake)
Executes the given listener.
|
protected boolean |
isAutoRenew() |
protected boolean |
isBatchEnabled()
Returns
true when batching is enabled. |
protected Boolean |
isDurable() |
protected boolean |
isFifo() |
protected Boolean |
isGuaranteed() |
protected Boolean |
isNotifyAll() |
protected Boolean |
isNotifyLeaseExpire() |
protected Boolean |
isNotifyMatchedUpdate() |
protected Boolean |
isNotifyRematchedUpdate() |
protected Boolean |
isNotifyTake() |
protected Boolean |
isNotifyUnmatched() |
protected Boolean |
isNotifyUpdate()
Turns on notifications for update operations.
|
protected Boolean |
isNotifyWrite() |
protected boolean |
isPassArrayAsIs() |
protected Boolean |
isReplicateNotifyTemplate() |
protected Boolean |
isTriggerNotifyTemplate() |
protected void |
registerListener() |
protected EventRegistration |
registerListener(DataEventSession dataEventSession,
RemoteEventListener listener)
Registers a listener using the provided
DataEventSession and
based on different parameters set on this container. |
void |
setAutoRenew(boolean autoRenew)
If
setListenerLease(long) is set, automatically performs lease renewal. |
void |
setBatchPendingThreshold(Integer batchPendingThreshold)
If set, turns batching event notifications where the server space accumalates notifications
to be sent and then send them in batch.
|
void |
setBatchSize(Integer batchSize)
If set, turns batching event notifications where the server space accumalates notifications
to be sent and then send them in batch.
|
void |
setBatchTime(Integer batchTime)
If set, turns batching event notifications where the server space accumalates notifications
to be sent and then send them in batch.
|
void |
setDurable(Boolean durable)
Controls if notifications will sustain disconnections and failover.
|
void |
setDynamicTemplate(Object templateProvider)
Called before each take and read polling operation to change the template Overrides any
template defined with
AbstractEventListenerContainer.setTemplate(Object) |
void |
setFifo(boolean fifo)
Determines if events arrives in the same order they were triggered by the space "server".
|
void |
setGuaranteed(Boolean guaranteed)
Deprecated.
Since 9.0 use
setDurable(Boolean) instead. |
void |
setIgnoreEventOnNullTake(boolean ignoreEventOnNullTake)
If set to
true , will not propagate the event if the take operation returned
null . |
void |
setLeaseListener(LeaseListener leaseListener)
If
setAutoRenew(boolean) is set to true sets the lease listener for
it. |
void |
setListenerLease(long listenerLease)
Deprecated.
Since 9.7 - event listener with custom lease is deprecated.
|
void |
setNotifyAll(Boolean notifyAll)
Turns on notifications for all operations.
|
void |
setNotifyFilter(INotifyDelegatorFilter notifyFilter)
Allows to register a filter on the server side that can filter out or modify notifications
that will be sent by the space "server".
|
void |
setNotifyLeaseExpire(Boolean notifyLeaseExpire)
Turns on notification for least expiration.
|
void |
setNotifyMatchedUpdate(Boolean notifyMatchedUpdate)
Turns on notifications for matched templates (a template that matches an entry after the
entry was updated and not before).
|
void |
setNotifyRematchedUpdate(Boolean notifyRematchedUpdate)
Turns on notifications for re-matched templates (a template that matches an entry before and
after the entry was updated).
|
void |
setNotifyTake(Boolean notifyTake)
Turns on notifications for take operations.
|
void |
setNotifyUnmatched(Boolean notifyUnmatched)
Turns on notifications for unmatched templates (a template that matched an entry but not it
does not).
|
void |
setNotifyUpdate(Boolean notifyUpdate)
Turns on notifications for update operations.
|
void |
setNotifyWrite(Boolean notifyWrite)
Turns on notifications for write operations.
|
void |
setPassArrayAsIs(boolean passArrayAsIs)
When batching is turned on, should the batch of events be passed as an
Object[]
to the listener. |
void |
setPerformTakeOnNotify(boolean performTakeOnNotify)
If set to
true will remove the event from the space using take operation. |
void |
setRenewDuration(long renewDuration)
Deprecated.
Since 9.7
|
void |
setRenewExpiration(long renewExpiration)
Deprecated.
Since 9.7
|
void |
setRenewRTT(long renewRTT)
Deprecated.
Since 9.7
|
void |
setReplicateNotifyTemplate(boolean replicateNotifyTemplate)
If using a replicated space controls if the listener will be replicated between all the
replicated cluster members.
|
void |
setTag(String tag)
A tag can be supplied to identify a durable notification listener endpoint for debug/auditing purposes.
|
void |
setTriggerNotifyTemplate(boolean triggerNotifyTemplate)
If using a replicated space controls if the listener that are replicated to cluster members
will raise notifications.
|
protected void |
validateConfiguration()
Validate the configuration of this container.
|
afterPropertiesSet, destroy, doRescheduleTask, doStart, doStop, executeListener, getActualEventListener, getApplicationContext, getBeanName, getEventListener, getEventListenerClass, getExceptionHandler, getFailedEvents, getGigaSpace, getProcessedEvents, getReceiveTemplate, getStatus, getTemplate, getTransactionDefinition, getTransactionManager, getTransactionManagerName, handleListenerException, incrementFailedEvents, invokeExceptionListener, invokeListener, isActive, isDynamicTemplate, isPerformSnapshot, isRunning, isTransactional, message, onApplicationEvent, process, registerMetrics, rescheduleTaskIfNecessary, setActiveWhenPrimary, setApplicationContext, setAutoStart, setBeanName, setDisableTransactionValidation, setEventListener, setEventListenerRef, setExceptionHandler, setGigaSpace, setPerformSnapshot, setProcessingUnitContainerContext, setRegisterSpaceModeListener, setTemplate, setTransactionIsolationLevel, setTransactionIsolationLevelName, setTransactionManager, setTransactionName, setTransactionTimeout, shutdown, start, stop, unregisterMetrics, waitWhileNotRunning
public void setFifo(boolean fifo)
protected boolean isFifo()
public void setBatchSize(Integer batchSize)
setBatchPendingThreshold(Integer)
is not specified, this
property will determine it as well. Note, if setting this property the setBatchTime(Integer)
must be set as well.protected Integer getBatchSize()
public void setBatchTime(Integer batchTime)
setBatchSize(Integer)
must be set as well.protected Integer getBatchTime()
public void setBatchPendingThreshold(Integer batchPendingThreshold)
setBatchSize(Integer)
will be used.protected Integer getBatchPendingThreshold()
public void setAutoRenew(boolean autoRenew)
setListenerLease(long)
is set, automatically performs lease renewal. Defaults to
false
.setListenerLease(long)
protected boolean isAutoRenew()
@Deprecated protected long getRenewExpiration()
setAutoRenew(boolean)
is true
.
Defaults to EventSessionConfig.DEFAULT_RENEW_EXPIRATION
.
@Deprecated public void setRenewExpiration(long renewExpiration)
setAutoRenew(boolean)
is true
.
Defaults to EventSessionConfig.DEFAULT_RENEW_EXPIRATION
.
@Deprecated protected long getRenewDuration()
setAutoRenew(boolean)
is
true
.
Defaults to EventSessionConfig.DEFAULT_RENEW_DURATION
.
@Deprecated public void setRenewDuration(long renewDuration)
setAutoRenew(boolean)
is
true
.
Defaults to EventSessionConfig.DEFAULT_RENEW_DURATION
.
@Deprecated protected long getRenewRTT()
setAutoRenew(boolean)
is true
.
Defaults to EventSessionConfig.DEFAULT_RENEW_RTT
.
@Deprecated public void setRenewRTT(long renewRTT)
setAutoRenew(boolean)
is true
.
Defaults to EventSessionConfig.DEFAULT_RENEW_RTT
.
public void setLeaseListener(LeaseListener leaseListener)
setAutoRenew(boolean)
is set to true
sets the lease listener for
it.@Deprecated public void setListenerLease(long listenerLease)
Lease.FOREVER
.setAutoRenew(boolean)
public void setNotifyFilter(INotifyDelegatorFilter notifyFilter)
public void setNotifyWrite(Boolean notifyWrite)
false
.protected Boolean isNotifyWrite()
public void setNotifyUpdate(Boolean notifyUpdate)
false
.protected Boolean isNotifyUpdate()
false
.public void setNotifyTake(Boolean notifyTake)
false
.protected Boolean isNotifyTake()
public void setNotifyAll(Boolean notifyAll)
false
.protected Boolean isNotifyAll()
public void setNotifyLeaseExpire(Boolean notifyLeaseExpire)
false
.protected Boolean isNotifyLeaseExpire()
public void setNotifyUnmatched(Boolean notifyUnmatched)
false
.public void setNotifyMatchedUpdate(Boolean notifyMatchedUpdate)
false
.public void setNotifyRematchedUpdate(Boolean notifyRematchedUpdate)
false
.protected Boolean isNotifyUnmatched()
protected Boolean isNotifyMatchedUpdate()
protected Boolean isNotifyRematchedUpdate()
public void setTriggerNotifyTemplate(boolean triggerNotifyTemplate)
setReplicateNotifyTemplate(boolean)
protected Boolean isTriggerNotifyTemplate()
public void setReplicateNotifyTemplate(boolean replicateNotifyTemplate)
If working directly with a cluster member, the default
value will be false
. Otherwise, the default value will be based on the cluster
schema (which is true for clusters with backups).
setTriggerNotifyTemplate(boolean)
protected Boolean isReplicateNotifyTemplate()
@Deprecated public void setGuaranteed(Boolean guaranteed)
setDurable(Boolean)
instead.protected Boolean isGuaranteed()
public void setDurable(Boolean durable)
protected Boolean isDurable()
public void setTag(String tag)
tag
- A name/id/tag to identify this durable notification listener endpoint.protected String getTag()
public void setPassArrayAsIs(boolean passArrayAsIs)
Object[]
to the listener. Default to false
which means it will be passed one event at a
time.public void setDynamicTemplate(Object templateProvider)
AbstractEventListenerContainer
AbstractEventListenerContainer.setTemplate(Object)
setDynamicTemplate
in class AbstractEventListenerContainer
templateProvider
- - An object that implements DynamicEventTemplateProvider
or
has a method annotated with DynamicEventTemplateProvider
protected boolean isPassArrayAsIs()
protected Boolean getNotifyWrite()
protected Boolean getNotifyUpdate()
protected Boolean getNotifyTake()
protected Boolean getNotifyLeaseExpire()
protected Boolean getNotifyUnmatched()
protected Boolean getNotifyMatchedUpdate()
protected Boolean getNotifyRematchedUpdate()
protected boolean isBatchEnabled()
true
when batching is enabled.public void setPerformTakeOnNotify(boolean performTakeOnNotify)
true
will remove the event from the space using take operation.
Default is false
.public void setIgnoreEventOnNullTake(boolean ignoreEventOnNullTake)
true
, will not propagate the event if the take operation returned
null
. This flag only makes sense when setPerformTakeOnNotify(boolean)
is set to true
. Defaults to false
.protected void validateConfiguration()
AbstractEventListenerContainer
validateConfiguration
in class AbstractEventListenerContainer
public void initialize() throws org.springframework.dao.DataAccessException
AbstractEventListenerContainer
true
will call AbstractEventListenerContainer.doStart()
(if it is set to true
,
lifecycle of the container will be controlled by the current space mode). AbstractEventListenerContainer.doInitialize()
will be called for additional initialization after the possible AbstractEventListenerContainer.doStart()
call.initialize
in class AbstractEventListenerContainer
org.springframework.dao.DataAccessException
AbstractEventListenerContainer.onApplicationEvent(org.springframework.context.ApplicationEvent)
protected void doInitialize() throws org.springframework.dao.DataAccessException
AbstractEventListenerContainer
doInitialize
in class AbstractEventListenerContainer
org.springframework.dao.DataAccessException
protected void doShutdown() throws org.springframework.dao.DataAccessException
AbstractEventListenerContainer
doShutdown
in class AbstractEventListenerContainer
org.springframework.dao.DataAccessException
AbstractEventListenerContainer.shutdown()
protected void doAfterStart() throws org.springframework.dao.DataAccessException
doAfterStart
in class AbstractEventListenerContainer
org.springframework.dao.DataAccessException
protected void doBeforeStop() throws org.springframework.dao.DataAccessException
doBeforeStop
in class AbstractEventListenerContainer
org.springframework.dao.DataAccessException
protected void registerListener() throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
protected void closeSession()
public ServiceDetails[] getServicesDetails()
ServiceDetailsProvider
public ServiceMonitors[] getServicesMonitors()
ServiceMonitorsProvider
public String getName()
protected String getEventListenerContainerType()
getEventListenerContainerType
in class AbstractEventListenerContainer
protected void dump(PrintWriter writer)
dump
in class AbstractEventListenerContainer
protected EventSessionConfig createEventSessionConfig() throws IllegalArgumentException
EventSessionConfig
based on the different
parameters this container accepts.IllegalArgumentException
protected EventRegistration registerListener(DataEventSession dataEventSession, RemoteEventListener listener) throws NotifyListenerRegistrationException
DataEventSession
and
based on different parameters set on this container.protected void invokeListenerWithTransaction(BatchRemoteEvent batchRemoteEvent, boolean performTakeOnNotify, boolean ignoreEventOnNullTake) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
protected void invokeListenerWithTransaction(Object eventData, Object source, boolean performTakeOnNotify, boolean ignoreEventOnNullTake) throws org.springframework.dao.DataAccessException
AbstractEventListenerContainer.setTransactionManager(org.springframework.transaction.PlatformTransactionManager)
is provided will perform the listener execution within a transaction, if not, the listener
execution is performed without a transaction. If the performTakeOnNotify flag is
set to true
will also perform take operation with the given event data (i.e.
remove it from the space).eventData
- The event data objectsource
- The remote notify eventperformTakeOnNotify
- A flag indicating whether to perform take operation with the given
event dataorg.springframework.dao.DataAccessException
Copyright © GigaSpaces.