\apex\app\interfaces\msgEventResponseInterface

Event response interface

This is the response received when dispatching messages via RPC or one-way direct messages.

Summary

Methods
Constants
set_type()
get_type()
get_routing_key()
get_function()
get_caller()
get_request()
get_params()
set_status()
add_response()
set_exception()
get_status()
get_called()
get_response()
get_exception()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

set_type()

set_type(string  $type)

Set the message type.

Parameters

string $type

Must be either 'rpc' or 'direct'.

get_type()

get_type(): string

Get the message type.

Returns

string —

The message type

get_routing_key()

get_routing_key(boolean  $return_full = false): string

Get the routing key

Parameters

boolean $return_full

If true, will return the routing key with function name. Defaults to false.

Returns

string —

$routing_key The routing key

get_function()

get_function(): string

et the function name.

Returns

string —

The function name to call.

get_caller()

get_caller(): array

Get the caller array.

Returns

array —

The caller function / class.

get_request()

get_request(): array

Get the contents of the request.

Returns

array —

Various information on the request such as URI, area, IP address, etc.

get_params()

get_params(): array

Get the params of the request.

Returns

array —

The params of the request.

set_status()

set_status(string  $status)

Set the status

Parameters

string $status

The overall status of the response. Must be either 'ok', 'fail', or 'error'

add_response()

add_response(string  $package,string  $class_name,string  $method,  $response)

Add a response

One RPC call can call methods without mltiple packages. This method is called after the RPC call is executed against any package, and adds the response from the package into the overall response object.

Parameters

string $package

The package the response came from

string $class_name

The class name that was executed

string $method

The method name that was executed

$response

set_exception()

set_exception(\apex\app\interfaces\msg\Exception  $e)

Set an exception

When an error occurs, this method is triggered which sets the status of the response to 'error' and includes the exception within.

Parameters

\apex\app\interfaces\msg\Exception $e

The exaction to add

get_status()

get_status(): string

Get status of the response

Returns

string —

The status of the response

get_called()

get_called(): array

Get all classes and methods called during execution.

Returns

array —

All classes and methods called.

get_response()

get_response(string  $package = ''): mixed

Get contents of the response, either a specific package, or all packages combined in an array.

Parameters

string $package

Optional package alias to return response of. If blank, returns array of all responses from all packages.

Returns

mixed —

Either response from a specific package if defined, or all responses.

get_exception()

get_exception(): \apex\app\interfaces\msg\exception

get the exception, only applicable if status is 'error'.

Returns

\apex\app\interfaces\msg\exception —

The exception object