\ConsumerStrategies_FileConsumer

Consumes messages and writes them to a file

Summary

Methods
Properties
Constants
__construct()
getNumThreads()
persist()
No public properties found
No constants found
_encode()
_handleError()
_log()
_debug()
$_options
N/A
No private methods found
$_defaults
$_file
N/A

Properties

$_options

$_options : array

An array of options to be used by the Mixpanel library.

Type

array

$_defaults

$_defaults : array

Default options that can be overridden via the $options constructor arg

Type

array

$_file

$_file : string

Type

string — path to a file that we want to write the messages to

Methods

__construct()

__construct(array  $options) 

Creates a new FileConsumer and assigns properties from the $options array

Parameters

array $options

getNumThreads()

getNumThreads() : integer

Number of requests/batches that will be processed in parallel.

Returns

integer

persist()

persist(array  $batch) : boolean

Append $batch to a file

Parameters

array $batch

an array of messages to consume

Returns

boolean

_encode()

_encode(array  $params) : string

Encode an array to be persisted

Parameters

array $params

Returns

string

_handleError()

_handleError(  $code,   $msg) 

Handles errors that occur in a consumer

Parameters

$code
$msg

_log()

_log(  $msg) 

Log a message to PHP's error log

Parameters

$msg

_debug()

_debug() : boolean

Returns true if in debug mode, false if in production mode

Returns

boolean