HandlersController
in package
Description of CallbackController
Tags
Table of Contents
Constants
Properties
- $handlers : array<string, array<string|int, object>>
- $queue : array<string, object|null>
- $rmqChannel : AMQPChannel
- $rmqConn : AMQPStreamConnection
- $rmqExceptionOnTimeout : bool
- $rmqQueue : string
- $rmqTimeout : float
Methods
- __construct() : mixed
- __destruct() : mixed
- callback() : void
- Handles the AMQP message received from a handler.
- handleResource() : DatasetNodeInterface
- handleTransaction() : void
- hasHandlers() : bool
- callFunction() : mixed
- callRpcResource() : DatasetNode
- sendRmqMessage() : null|Dataset
Constants
TYPE_FUNC
public
mixed
TYPE_FUNC
= 'function'
TYPE_RPC
public
mixed
TYPE_RPC
= 'rpc'
Properties
$handlers
private
array<string, array<string|int, object>>
$handlers
= []
$queue
private
array<string, object|null>
$queue
$rmqChannel
private
AMQPChannel
$rmqChannel
$rmqConn
private
AMQPStreamConnection
$rmqConn
$rmqExceptionOnTimeout
private
bool
$rmqExceptionOnTimeout
= true
$rmqQueue
private
string
$rmqQueue
$rmqTimeout
private
float
$rmqTimeout
= 1
Methods
__construct()
public
__construct(Config $cfg, ClassLoader $loader) : mixed
Parameters
- $cfg : Config
- $loader : ClassLoader
__destruct()
public
__destruct() : mixed
callback()
Handles the AMQP message received from a handler.
public
callback(AMQPMessage $msg) : void
The message should be a JSON with at least status
property.
Status 0 means successful execution and any other value indicates an error.
In case of error an exception is being thrown with the exception code
equal to the status
property value and exception message read from
the message
field of the response (if it's not preset, a generic
error message is used).
In status
equals 0, then the metadata
property value (or an empty
string if this property doesn't exist) is parsed as application/n-triples.
Parameters
- $msg : AMQPMessage
handleResource()
public
handleResource(string $method, int $id, DatasetNodeInterface $res, string|null $path) : DatasetNodeInterface
Parameters
- $method : string
- $id : int
- $res : DatasetNodeInterface
- $path : string|null
Return values
DatasetNodeInterfacehandleTransaction()
public
handleTransaction(string $method, int $txId, array<string|int, int> $resourceIds) : void
Parameters
- $method : string
- $txId : int
- $resourceIds : array<string|int, int>
Tags
hasHandlers()
public
hasHandlers(string $method) : bool
Parameters
- $method : string
Return values
boolcallFunction()
private
callFunction(string $func, mixed ...$params) : mixed
Parameters
- $func : string
- $params : mixed
callRpcResource()
private
callRpcResource(string $method, string $queue, int $id, DatasetNode $res, string|null $path) : DatasetNode
Parameters
- $method : string
- $queue : string
- $id : int
- $res : DatasetNode
- $path : string|null
Return values
DatasetNodesendRmqMessage()
private
sendRmqMessage(string $queue, string $data) : null|Dataset
Parameters
- $queue : string
- $data : string