Documentation

HandlersController
in package

Description of CallbackController

Tags
author

zozlak

Table of Contents

Constants

TYPE_FUNC  = 'function'
TYPE_RPC  = 'rpc'

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

Properties

Methods

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
DatasetNodeInterface

handleTransaction()

public handleTransaction(string $method, int $txId, array<string|int, int> $resourceIds) : void
Parameters
$method : string
$txId : int
$resourceIds : array<string|int, int>
Tags
throws
RepoException

hasHandlers()

public hasHandlers(string $method) : bool
Parameters
$method : string
Return values
bool

callFunction()

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
DatasetNode

sendRmqMessage()

private sendRmqMessage(string $queue, string $data) : null|Dataset
Parameters
$queue : string
$data : string
Tags
throws
RepoException
Return values
null|Dataset

        
On this page

Search results