FileAccess Orion

AbstractConsumer
in package
implements Iterator

Base implementation of a PUB/SUB consumer abstraction based on PHP iterators.

Tags
author

Daniele Alessandri suppakilla@gmail.com

Interfaces, Classes, Traits and Enums

Iterator

Table of Contents

MESSAGE  = 'message'
PMESSAGE  = 'pmessage'
PONG  = 'pong'
PSUBSCRIBE  = 'psubscribe'
PUNSUBSCRIBE  = 'punsubscribe'
STATUS_PSUBSCRIBED  = 4
STATUS_SUBSCRIBED  = 2
STATUS_VALID  = 1
SUBSCRIBE  = 'subscribe'
UNSUBSCRIBE  = 'unsubscribe'
$position  : mixed
$statusFlags  : mixed
__destruct()  : mixed
Automatically stops the consumer when the garbage collector kicks in.
current()  : array<string|int, mixed>
Returns the last message payload retrieved from the server and generated by one of the active subscriptions.
key()  : mixed
{@inheritdoc}
next()  : mixed
{@inheritdoc}
ping()  : mixed
PING the server with an optional payload that will be echoed as a PONG message in the pub/sub loop.
psubscribe()  : mixed
Subscribes to the specified channels using a pattern.
punsubscribe()  : mixed
Unsubscribes from the specified channels using a pattern.
rewind()  : mixed
{@inheritdoc}
stop()  : bool
Closes the context by unsubscribing from all the subscribed channels. The context can be forcefully closed by dropping the underlying connection.
subscribe()  : mixed
Subscribes to the specified channels.
unsubscribe()  : mixed
Unsubscribes from the specified channels.
valid()  : bool
Checks if the the consumer is still in a valid state to continue.
disconnect()  : mixed
Closes the underlying connection when forcing a disconnection.
getValue()  : array<string|int, mixed>
Waits for a new message from the server generated by one of the active subscriptions and returns it when available.
invalidate()  : mixed
Resets the state of the consumer.
isFlagSet()  : bool
Checks if the specified flag is valid based on the state of the consumer.
writeRequest()  : mixed
Writes a Redis command on the underlying connection.

Constants

Properties

Methods

__destruct()

Automatically stops the consumer when the garbage collector kicks in.

public __destruct() : mixed
Return values
mixed

current()

Returns the last message payload retrieved from the server and generated by one of the active subscriptions.

public current() : array<string|int, mixed>
Return values
array<string|int, mixed>

ping()

PING the server with an optional payload that will be echoed as a PONG message in the pub/sub loop.

public ping([string $payload = null ]) : mixed
Parameters
$payload : string = null

Optional PING payload.

Return values
mixed

psubscribe()

Subscribes to the specified channels using a pattern.

public psubscribe(mixed $pattern) : mixed
Parameters
$pattern : mixed
Return values
mixed

punsubscribe()

Unsubscribes from the specified channels using a pattern.

public punsubscribe() : mixed
Return values
mixed

stop()

Closes the context by unsubscribing from all the subscribed channels. The context can be forcefully closed by dropping the underlying connection.

public stop([bool $drop = false ]) : bool
Parameters
$drop : bool = false

Indicates if the context should be closed by dropping the connection.

Return values
bool

Returns false when there are no pending messages.

subscribe()

Subscribes to the specified channels.

public subscribe(mixed $channel) : mixed
Parameters
$channel : mixed
Return values
mixed

unsubscribe()

Unsubscribes from the specified channels.

public unsubscribe() : mixed
Return values
mixed

valid()

Checks if the the consumer is still in a valid state to continue.

public valid() : bool
Return values
bool

disconnect()

Closes the underlying connection when forcing a disconnection.

protected abstract disconnect() : mixed
Return values
mixed

getValue()

Waits for a new message from the server generated by one of the active subscriptions and returns it when available.

protected abstract getValue() : array<string|int, mixed>
Return values
array<string|int, mixed>

invalidate()

Resets the state of the consumer.

protected invalidate() : mixed
Return values
mixed

isFlagSet()

Checks if the specified flag is valid based on the state of the consumer.

protected isFlagSet(int $value) : bool
Parameters
$value : int

Flag.

Return values
bool

writeRequest()

Writes a Redis command on the underlying connection.

protected abstract writeRequest(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string

Command ID.

$arguments : array<string|int, mixed>

Arguments for the command.

Return values
mixed

Search results