Class BatchBuilder
Builder used to create custom batch objects
Methods summary
-
public staticfactory ( )Create a new instance of the BatchBuilder
-
publicautoFlushAt ( mixed $threshold )Automatically flush the batch when the size of the queue reaches a certain threshold. Adds
Guzzle\Batch\FlushingBatch. -
publickeepHistory ( )Maintain a history of all items that have been transferred using the batch. Adds
Guzzle\Batch\HistoryBatch. -
publicbufferExceptions ( )Buffer exceptions thrown during transfer so that you can transfer as much as possible, and after a transfer completes, inspect each exception that was thrown. Enables the
Guzzle\Batch\ExceptionBufferingBatchdecorator. -
publicnotify ( mixed $callable )Notify a callable each time a batch flush completes. Enables the
Guzzle\Batch\NotifyingBatchdecorator. -
publictransferRequests ( int $batchSize = 50 )Configures the batch to transfer batches of requests. Associates a \Guzzle\Http\BatchRequestTransfer object as both the transfer and divisor strategy.
-
publictransferCommands ( int $batchSize = 50 )Configures the batch to transfer batches commands. Associates as \Guzzle\Service\Command\BatchCommandTransfer as both the transfer and divisor strategy.
-
publiccreateBatchesWith ( Guzzle\Batch\BatchDivisorInterface $divisorStrategy )Specify the strategy used to divide the queue into an array of batches
-
publictransferWith ( Guzzle\Batch\BatchTransferInterface $transferStrategy )Specify the strategy used to transport the items when flush is called
-
publicbuild ( )Create and return the instantiated batch
Methods detail
Automatically flush the batch when the size of the queue reaches a certain
threshold. Adds Guzzle\Batch\FlushingBatch.
Parameters
- $threshold
mixed
$threshold Number of items to allow in the queue before a flush
Returns
Maintain a history of all items that have been transferred using the batch.
Adds Guzzle\Batch\HistoryBatch.
Returns
Buffer exceptions thrown during transfer so that you can transfer as much as
possible, and after a transfer completes, inspect each exception that was
thrown. Enables the Guzzle\Batch\ExceptionBufferingBatch decorator.
Returns
Notify a callable each time a batch flush completes. Enables the Guzzle\Batch\NotifyingBatch decorator.
Parameters
- $callable
mixed
$callable Callable function to notify
Returns
Throws
Configures the batch to transfer batches of requests. Associates a \Guzzle\Http\BatchRequestTransfer object as both the transfer and divisor strategy.
Parameters
- $batchSize
integer
$batchSize Batch size for each batch of requests
Returns
Configures the batch to transfer batches commands. Associates as \Guzzle\Service\Command\BatchCommandTransfer as both the transfer and divisor strategy.
Parameters
- $batchSize
integer
$batchSize Batch size for each batch of commands
Returns
public
Guzzle\Batch\BatchBuilder
createBatchesWith( Guzzle\Batch\BatchDivisorInterface $divisorStrategy )
Specify the strategy used to divide the queue into an array of batches
Parameters
- $divisorStrategy
Guzzle\Batch\BatchDivisorInterface
$divisorStrategy Strategy used to divide a batch queue into batches
Returns
public
Guzzle\Batch\BatchBuilder
transferWith( Guzzle\Batch\BatchTransferInterface $transferStrategy )
Specify the strategy used to transport the items when flush is called
Parameters
- $transferStrategy
Guzzle\Batch\BatchTransferInterface
$transferStrategy How items are transferred
Returns
Create and return the instantiated batch
Returns
Throws
Magic methods summary
Properties summary
protected
boolean
|
$autoFlush |
#
Whether or not the batch should automatically flush |
protected
boolean
|
$history |
#
Whether or not to maintain a batch history |
protected
boolean
|
$exceptionBuffering |
#
Whether or not to buffer exceptions encountered in transfer |
protected
mixed
|
$afterFlush |
#
Callable to invoke each time a flush completes |
protected
|
$transferStrategy |
#
Object used to transfer items in the queue |
protected
|
$divisorStrategy |
#
Object used to divide the queue into batches |
protected static
array
|
$mapping |
#
of Mapped transfer strategies by handle name |