7.23 Receiver Object
| Used on |
|
| Description | This is the event that takes entries from a space to mimic a queue handler.
It is equivalent to a queue receiver in J2EE JMS or Spring, or the consumer of a consumer/provider pair in older concurrent programming.
In GigaSpaces, it maps to a polling container with Single*Take* receive handler;
this means that an instance of the input object is only ever handled by one receiver.
Only the write of an entry into the space causes this type of event; updates do not.
The business method that is generated is placed on the PU's actions class, which has the extension '_Actions',
and is named using Java conventions.
For example, if the PU name 'MyPU' and the subscriber is named "Sub-a1" then the method will be 'MyPU_Actions.subA1()'.
The FIFO aspect of the order of objects retrieved by a browser is determined by the type of object being retrieved
or the space.
The simple pattern here is to define a specific JavaBean for the browser to read
and then set the FIFO property on that.
|
Inherited properties |
| template |
(base property)
| |
| text |
(base property)
| |
| jwpattern |
(base property)
| |
|
7.23.1 Property 'allowInPartitionedPU'
|
| Description | Defines whether this event can be used in a partitioned PU.
The issue here is that if the event is in a partitioned PU,
then each event in the space will cause an action in every partition:
the same event will trigger threads in each space to run the event.
This flag is ignored if the space is local to the event's PU and the 'useRemoteSpace' flag is false (which is the default);
in this case, there will be an event handler in each partition instance, but it will only react to events in the local space.
Note that use of this flag is likely to be the unusual case.
We expect the normal cases to be a
- a local space with 'useRemoteSpace' set to false, so each data event causes only one program event across the whole cluster
- a remote space cause events in a PU that is not partitioned, so allowInPartitionedPU can be false.
If the PU containing this event is partitioned in a particular deploymentOption, the following cases result in an error when the deployment is created:
- the space is local, useRemoteSpace is true and allowInPartitionedPU is false
- the space is remote and allowInPartitionedPU is false.
|
| Type | boolean |
| Default | false |
7.23.2 Property 'description'
|
7.23.3 Property 'handler'
|
| Description | The handler that is configured for an event affects the performance and functionality of the action.
By default, GigaSystemBuilder configures event handlers as follows:
- use the 'read' operation rather 'take' from the space.
This is because if you take from the space and it is backed-up, then the entry will be lost if the primary crashes.
- not to use transactions. This is because other operations must be performed using the same transaction manager
and GigaSystemBuilder doesn't support this yet.
- to read in batches of 10. This gives near-optimal performance.
- to be notified only on write, and update if specified (subscribers only).
As configuring the handler is a complicated area,
GigaSystemBuilder allows you to override the standard generated handler with your own and specifying the expression here.
A common way of doing this is the specify a getter method in the "Additional Code" area of the PU's "...Actions" class.
If this were called "getSpecialHandler", then you would specify handler="getSpecialHandler()".
|
| Type | String |
7.23.4 Property 'name'
|
| Description | The name of the action. This must be unique across all other actions (and pulses) within the PU.
|
| Type | String |
| Required | true |
7.23.5 Property 'space'
|
| Description | The space that this event happens in.
|
| Type | String |
| Required | true |
7.23.6 Property 'sqlQueryWhereClause'
|
| Description | The where clause of the SQL query to use for this event. See templateBean for more details.
You cannot use this in conjunction with a templateValues setting.
|
| Type | String |
7.23.7 Property 'templateBean'
|
| Description | The templateBean defines the type of object (POJO/JavaBean) that triggers this event. It must be specified.
You can further restrict the set of objects that trigger the event by using one (but not both) of the following:
- set the templateValues property, with additional settings for the fields in the bean
- set the sqlQueryWhereClause. In this case, instances of the bean must also match the specified SQL query to cause the event.
|
| Type | String |
| Required | true |
7.23.8 Property 'templateValues'
|
| Description | The templateValues is a list of initialisation values for fields in the template bean.
For example, if you want only beans with the field f equal to 2, specify "f=2".
If you need to specify two or more values, separate them with ';', e.g. "f=2; g=NEEDS_WASHING".
Only use the name of the field on the left-hand-side.
You cannot use this in conjunction with the sqlQueryWhereClause.
|
| Type | String |
7.23.9 Property 'useRemoteSpace'
|
| Description | This flag is ignored if this event and its target space are in different PUs - i.e. they are remote to each other.
If this event and its target space are in the same PU - they are local to each other -
- if this flag is false it means that the space should be referenced using a local URL,
which means that only data changes from the local space will trigger the event.
- if this flag is set true, then a remote URL is used to access the space, meaning that data changes from the complete space will trigger the event.
See the "allowInPartitionedPU" flag for further details of this.
|
| Type | boolean |
| Default | false |
|