\apex\app\msgdispatcher

Event Dispatcher

Service: apex\svc\msg

Handles all the two-way RPC calls between Apex and RabbitMQ. Messages sent here will not be returned until a response has been received from all listeners.

This class is available within the services container, meaning its methods can be accessed statically via the service singleton as shown below.

PHP Example

<?php

namespace apex;

use apex\app; use apex\svc\msg; use apex\app\msg\objects\event_message;

// Set some message vars $vars = array( 'name' => 'John', 'email' => '[email protected]' );

// Send a RPC call $msg = new event_message('mypackage.rkey.method', $vars); $response = msg::dispatch($msg)->get_response('mypackage');

Summary

Methods
Properties
Constants
get_rabbitmq_connection()
get_rabbitmq_connection_info()
get_listeners()
dispatch_locally()
__construct()
dispatch()
onresponse()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$rabbitmq_conn
$connection
$channel
$callback_queue
$response
$corr_id
$channel_name
N/A

Properties

$rabbitmq_conn

$rabbitmq_conn :

Type

$connection

$connection :

Type

$channel

$channel :

Type

$callback_queue

$callback_queue :

Type

$response

$response :

Type

$corr_id

$corr_id :

Type

$channel_name

$channel_name :

Type

Methods

get_rabbitmq_connection()

get_rabbitmq_connection()

Get connection to the RabbitMQ server

get_rabbitmq_connection_info()

get_rabbitmq_connection_info(): array

Get RabbitMQ connection information

Returns

array —

Connection info for RabbitMQ

get_listeners()

get_listeners(string  $routing_key): array

Get listeners for a given routing key

Parameters

string $routing_key

The routing key to get listeners for.

Returns

array —

One-dimensional name of class files that act as listeners

__construct()

__construct(string  $channel_name = 'apex')

Construct. Grab some injected dependencies we need.

Parameters

string $channel_name

The channel nqme to send messages though, defaults to 'apex'.

onresponse()

onresponse(  $response)

on response

Parameters

$response