model/modx/registry/modregister.class.php
- 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
- Classes
- modRegister
Description
Represents a container used for producing and consuming messages.
\modRegister
- 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
- Properties
- $__kill
- $_currentTopic
- $_key
- $modx
- $options
- $subscriptions
- Methods
- __construct
- abort
- acknowledge
- begin
- close
- commit
- connect
- getKey
- read
- send
- setCurrentTopic
- subscribe
- unsubscribe
Description
Represents a container used for producing and consuming messages.
Properties
$__kill
boolean $__kill = 'false'
A polling flag that will terminate additional polling when true.
Details
- boolean
- visibility
- public
- default
- false
- final
- false
- static
- false
$_currentTopic
string $_currentTopic = '/'
An optional current topic to allow writes to relative paths.
Details
- string
- visibility
- protected
- default
- /
- final
- false
- static
- false
- access
- protected
$_key
string $_key = 'null'
The key identifying this register in a registry.
Details
- string
- visibility
- protected
- default
- null
- final
- false
- static
- false
- access
- protected
$modx
\modX $modx = 'null'
A reference to the modX instance the register is loaded by.
Details
-
\modX
- visibility
- public
- default
- null
- final
- false
- static
- false
- access
- public
$options
array $options = 'null'
An array of global options applied to the registry.
Details
- array
- visibility
- public
- default
- null
- final
- false
- static
- false
- access
- public
$subscriptions
array $subscriptions = 'array'
An array of topics and/or messages the register is subscribed to.
Details
- array
- visibility
- public
- default
- array
- final
- false
- static
- false
- access
- public
Methods
__construct
__construct(
\modX $modx, string $key, array $options
=
array
)
:
Construct a new modRegister.
Arguments
- $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.
Details
- visibility
- public
- final
- false
- static
- false
abort
abort(
$transactionKey
)
:
void
Arguments
- $transactionKey
Details
- visibility
- public
- final
- false
- static
- false
acknowledge
acknowledge(
string $messageKey, string $transactionKey
)
:
void
Acknowledge the registry was read
Arguments
- $messageKey
- string
The key of the message being read - $transactionKey
- string
The secure key of the transaction that is reading
Details
- visibility
- public
- final
- false
- static
- false
begin
begin(
\$transactionKey $transactionKey
)
:
void
Begin the reading of the message
Arguments
- $transactionKey
- \$transactionKey
The key of the message
Details
- visibility
- public
- final
- false
- static
- false
close
close(
)
:
boolean
Close the connection to the register service implementation.
Output
- boolean
- Indicates if the connection was closed successfully.
Details
- visibility
- public
- final
- false
- static
- false
- abstract
- Implement this only if necessary for the implementation.
commit
commit(
string $transactionKey
)
:
void
Commit the transaction and finish
Arguments
- $transactionKey
- string
The key of the transaction
Details
- visibility
- public
- final
- false
- static
- false
connect
connect(
array $attributes
=
array
)
:
boolean
Connect to the register service implementation.
Arguments
- $attributes
- array
A collection of attributes required for connection to the register.
Output
- boolean
- Indicates if the connection was successful.
Details
- visibility
- public
- final
- false
- static
- false
- abstract
- Implement this only if necessary for the implementation.
getKey
getKey(
)
:
string
Get the key of this registry
Output
- string
- The key of the current registry
Details
- visibility
- public
- final
- false
- static
- false
read
read(
array $options
=
array
)
:
mixed
Reads any undigested messages from subscribed topics.
Arguments
- $options
- array
An array of general or protocol specific options.
Output
- mixed
- The resulting message from the register.
Details
- visibility
- public
- final
- false
- static
- false
send
send(
string $topic, mixed $message, array $options
=
array
)
:
boolean
Send a message to the register.
Arguments
- $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.
Output
- boolean
- Indicates if the message was recorded.
Details
- visibility
- public
- final
- false
- static
- false
- 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
setCurrentTopic(
string $topic
)
:
void
Set the current topic to be read
Arguments
- $topic
- string
The key of the topic
Details
- visibility
- public
- final
- false
- static
- false
subscribe
subscribe(
string $topic
)
:
boolean
Subscribe to a topic (or specific message) in the register.
Arguments
- $topic
- string
The path representing the topic or message.
Output
- boolean
- Indicates if the subscription was successful.
Details
- visibility
- public
- final
- false
- static
- false
unsubscribe
unsubscribe(
string $topic
)
:
boolean
Unsubscribe from a topic (or specific message) in the register.
Arguments
- $topic
- string
The path representing the topic or message.
Output
- boolean
- Indicates if the subscription was removed successfully.
Details
- visibility
- public
- final
- false
- static
- false