core/model/modx/registry/modregister.class.php
Represents a container used for producing and consuming messages.
- Abstract
- Implement a derivative of this class to provide the behavior for the abstract methods, or override other public or protected methods at your discretion.
- Package
- modx
- Subpackage
- registry
\modRegister
Represents a container used for producing and consuming messages.
- Children
- \modFileRegister
- \modDbRegister
- Abstract
- Implement a derivative of this class to provide the behavior for the abstract methods, or override other public or protected methods at your discretion.
Properties
boolean
$__kill= 'false'
A polling flag that will terminate additional polling when true.
false
Details- Type
- boolean
string
$_currentTopic= ''/''
An optional current topic to allow writes to relative paths.
'/'
Details- Type
- string
- Access
- protected
string
$_key= 'null'
The key identifying this register in a registry.
null
Details- Type
- string
- Access
- protected
\modX
$modx= 'null'
A reference to the modX instance the register is loaded by.
null
Details- Type
- \modX
- Access
- public
array
$options= 'null'
An array of global options applied to the registry.
null
Details- Type
- array
- Access
- public
Methods
__construct(
\modX $modx, string $key, array $options
=
array()
)
:
void
Construct a new modRegister.
Name | Type | Description |
---|---|---|
$modx | \modX | &$modx A reference to a modX instance. |
$key | string | A valid PHP variable which will be set on the modRegistry instance. |
$options | array | Optional array of registry options. |
acknowledge(
string $messageKey, string $transactionKey
)
:
void
Acknowledge the registry was read
Name | Type | Description |
---|---|---|
$messageKey | string | The key of the message being read |
$transactionKey | string | The secure key of the transaction that is reading |
begin(
\$transactionKey $transactionKey
)
:
void
Begin the reading of the message
Name | Type | Description |
---|---|---|
$transactionKey | \$transactionKey | The key of the message |
close(
)
:
boolean
Close the connection to the register service implementation.
Type | Description |
---|---|
boolean | Indicates if the connection was closed successfully. |
- Abstract
- Implement this only if necessary for the implementation.
commit(
string $transactionKey
)
:
void
Commit the transaction and finish
Name | Type | Description |
---|---|---|
$transactionKey | string | The key of the transaction |
connect(
array $attributes
=
array()
)
:
boolean
Connect to the register service implementation.
Name | Type | Description |
---|---|---|
$attributes | array | A collection of attributes required for connection to the register. |
Type | Description |
---|---|
boolean | Indicates if the connection was successful. |
- Abstract
- Implement this only if necessary for the implementation.
getCurrentTopic(
)
:
string
Get the current topic of the register.
Type | Description |
---|---|
string | The current topic set for the register. |
getKey(
)
:
string
Get the key of this registry
Type | Description |
---|---|
string | The key of the current registry |
read(
array $options
=
array()
)
:
mixed
Reads any undigested messages from subscribed topics.
Name | Type | Description |
---|---|---|
$options | array | An array of general or protocol specific options. |
Type | Description |
---|---|
mixed | The resulting message from the register. |
send(
string $topic, mixed $message, array $options
=
array()
)
:
boolean
Send a message to the register.
Name | Type | Description |
---|---|---|
$topic | string | A topic container in which to broadcast the message. |
$message | mixed | A message, or collection of messages to be sent to the register. |
$options | array | An optional array of general or protocol specific message properties. |
Type | Description |
---|---|
boolean | Indicates if the message was recorded. |
- Abstract
- Implement this function in derivatives to send a message to a specific register (e.g. modFileRegister for file-based registers, modStompRegister for ActiveMQ, etc.).
setCurrentTopic(
string $topic
)
:
void
Set the current topic to be read
Name | Type | Description |
---|---|---|
$topic | string | The key of the topic |
subscribe(
string $topic
)
:
boolean
Subscribe to a topic (or specific message) in the register.
Name | Type | Description |
---|---|---|
$topic | string | The path representing the topic or message. |
Type | Description |
---|---|
boolean | Indicates if the subscription was successful. |