GigaSpaces XAP 7.0 API

org.openspaces.events.polling
Annotation Type Polling


@Target(value=TYPE)
@Retention(value=RUNTIME)
@Component
public @interface Polling

Marks an event listener as polled event listener. It will be wrapped automtically with SimplePollingEventListenerContainer.

Template can be provided using EventTemplate marked on a general method that returns the template.

The event listener method should be marked with SpaceDataEvent.

Author:
kimchy
See Also:
TransactionalEvent, ReceiveHandler, TriggerHandler

Optional Element Summary
 boolean autoStart
          Set whether this container will start once instantiated.
 int concurrentConsumers
          Specify the number of concurrent consumers to create.
 String gigaSpace
          The name of the bean that that is the GigaSpace this container will used.
 int maxConcurrentConsumers
          Specify the maximum number of concurrent consumers to create.
 boolean passArrayAsIs
          If set to true will pass an array value returned from a ReceiveOperationHandler directly to the listener without "serializing" it as one array element each time.
 boolean performSnapshot
          If set to true will perform snapshot operation on the provided template before invoking registering as an event listener.
 long receiveTimeout
          Set the timeout to use for receive calls, in milliseconds.
 long recoveryInterval
           
 String value
          The value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.
 

value

public abstract String value
The value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.

Returns:
the suggested component name, if any
Default:
""

gigaSpace

public abstract String gigaSpace
The name of the bean that that is the GigaSpace this container will used.

Note, this is optional. If there is only one GigaSpace defined in the application context, it will be used.

Default:
""

concurrentConsumers

public abstract int concurrentConsumers
Specify the number of concurrent consumers to create. Default is 1.

Specifying a higher value for this setting will increase the standard level of scheduled concurrent consumers at runtime: This is effectively the minimum number of concurrent consumers which will be scheduled at any given time. This is a static setting; for dynamic scaling, consider specifying the "maxConcurrentConsumers" setting instead.

Raising the number of concurrent consumers is recommendable in order to scale the consumption of events. However, note that any ordering guarantees are lost once multiple consumers are registered. In general, stick with 1 consumer for low-volume events.

See Also:
SimplePollingEventListenerContainer.setConcurrentConsumers(int)
Default:
1

maxConcurrentConsumers

public abstract int maxConcurrentConsumers
Specify the maximum number of concurrent consumers to create. Default is 1.

If this setting is higher than "concurrentConsumers", the listener container will dynamically schedule new consumers at runtime, provided that enough incoming messages are encountered. Once the load goes down again, the number of consumers will be reduced to the standard level ("concurrentConsumers") again.

Raising the number of concurrent consumers is recommendable in order to scale the consumption of events. However, note that any ordering guarantees are lost once multiple consumers are registered. In general, stick with 1 consumer for low-volume events.

See Also:
SimplePollingEventListenerContainer.setMaxConcurrentConsumers(int)
Default:
1

receiveTimeout

public abstract long receiveTimeout
Set the timeout to use for receive calls, in milliseconds. The default is 60000 ms, that is, 1 minute.

NOTE: This value needs to be smaller than the transaction timeout used by the transaction manager (in the appropriate unit, of course).

See Also:
AbstractPollingEventListenerContainer.setReceiveTimeout(long)
Default:
60000L

performSnapshot

public abstract boolean performSnapshot
If set to true will perform snapshot operation on the provided template before invoking registering as an event listener.

See Also:
GigaSpace.snapshot(Object), AbstractTemplateEventListenerContainer.setPerformSnapshot(boolean)
Default:
true

autoStart

public abstract boolean autoStart
Set whether this container will start once instantiated.

Default is true. Set to false in order for this container to be started using AbstractSpaceListeningContainer.start().

Default:
true

passArrayAsIs

public abstract boolean passArrayAsIs
If set to true will pass an array value returned from a ReceiveOperationHandler directly to the listener without "serializing" it as one array element each time. Defaults to false

See Also:
AbstractPollingEventListenerContainer.setPassArrayAsIs(boolean)
Default:
false

recoveryInterval

public abstract long recoveryInterval
See Also:
SimplePollingEventListenerContainer.setRecoveryInterval(long)
Default:
5000L

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.