MAKS\AmqpAgent\RPC\AbstractEndpoint
An abstract class implementing the basic functionality of an endpoint.
Synopsis
class AbstractEndpoint
implements
AbstractEndpointInterface
{
- // members
- protected $connectionOptions;
- protected $queueName;
- protected bool $connected;
- protected AMQPStreamConnection $connection;
- protected AMQPChannel $channel;
- protected $requestBody;
- protected $requestQueue;
- protected $responseBody;
- protected $responseQueue;
- protected $correlationId;
- // methods
- public void __construct()
- public void __destruct()
- public AbstractEndpoint connect()
- public void disconnect()
- public bool isConnected()
- public AMQPStreamConnection getConnection()
- public final float ping()
- public final AbstractEndpoint on()
- protected abstract string callback()
- // Inherited methods from MagicMethodsExceptionsTrait
- public void __get()
- public void __set()
- public mixed __call()
- public static mixed __callStatic()
- // Inherited methods from EventTrait
- protected static void trigger()
- protected static void bind()
- public static array getEvents()
Hierarchy
Uses
Implements
Coverage
Methods | 88.89% | 8 / 9 |
Lines | 98.73% | 78 / 79 |
Violations
PHPMessDetector
Line | Rule | Message |
---|---|---|
275 - 288 | ShortMethodName | Avoid using short method names like AbstractEndpoint::on(). The configured minimum method name length is 3. |
Members
protected
- $channel
—
PhpAmqpLib\Channel\AMQPChannel
The endpoint channel. - $connected
—
MAKS\AmqpAgent\RPC\bool
Whether the endpoint is connected to RabbitMQ server or not. - $connection
—
PhpAmqpLib\Connection\AMQPStreamConnection
The endpoint connection. - $connectionOptions
—
array
The connection options of the RPC endpoint. - $correlationId
—
string
Correlation ID of the last request/response. - $events
—
array
Here lives all bindings. - $queueName
—
string
The queue name of the RPC endpoint. - $requestBody
—
string
The request body. - $requestQueue
—
string
Requests conveyor. - $responseBody
—
string
The response body. - $responseQueue
—
string
Responses conveyor.
Methods
protected
- callback() — Hook method to manipulate the message (request/response) when extending the class.
public
- __construct() — Class constructor.
- __destruct() — Closes the connection with RabbitMQ server before destroying the object.
- connect() — Opens a connection with RabbitMQ server.
- disconnect() — Closes the connection with RabbitMQ server.
- getConnection() — Returns the connection used by the endpoint.
- isConnected() — Returns whether the endpoint is connected or not.
- on() — Hooking method based on events to manipulate the request/response during the endpoint/message life cycle.
- ping() — The time needed for the round-trip to RabbitMQ server in milliseconds.
Inherited from MAKS\AmqpAgent\Exception\MagicMethodsExceptionsTrait
public
- __call() — Throws an exception for calls to undefined methods.
- __callStatic() — Throws an exception for calls to undefined static methods.
- __get() — Throws an exception when trying to get a class member via public property assignment notation.
- __set() — Throws an exception when trying to set a class member via public property assignment notation.
Inherited from MAKS\AmqpAgent\Helper\EventTrait
protected
- bind() — Binds the passed function to the passed event.
- trigger() — Executes callbacks attached to the passed event with the passed arguments.
public
- getEvents() — Returns array of all registered events as an array `['event.name' => [$cb1, $cb2, ...]]`.
History
-
2021-01-12T21:10:22+00:00 (commit #092a1ce)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update abstract endpoint class * Fix typos * Update DocBlocks
-
2021-01-12T21:10:21+00:00 (commit #d09424b)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Add strict types declaration * Add declare(strict_types=1) to all files * Fix file header DocBlock spacing of all files
-
2020-12-03T21:44:11+00:00 (commit #717aea4)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update abstract endpoint class * Fix a wrong type in DocBlocks * Change some properties names for better code readability * Remove self return type from some method signatures
-
2020-12-02T22:59:19+00:00 (commit #8540f3a)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Add abstract endpoint class * Add AbstractEndpoint.php * Add RPCEndpointException.php