MAKS\AmqpAgent\Worker\Publisher::publishBatch
Publishes a batch of messages to the default exchange on the default channel of the worker's connection to RabbitMQ server.
Signature
public function publishBatch(array
$messages,
[integer
$batchSize = 2500,
[array
$parameters = NULL,
[AMQPChannel
$_channel = NULL]]] )
Parameters
$messages
—
array
- An array of bodies of the messages or an array of arrays of body and properties for the messages or an array of AMQPMessage objects.
$batchSize
—
integer
- [optional] The number of messages that should be published per batch.
$parameters
—
array
- [optional] The overrides for the default publish options of the worker.
$_channel
—
MAKS\AmqpAgent\Worker\AMQPChannel|null
- [optional] The channel that should be used instead of the default worker's channel.
Returns
- Publisher
Errors/Exceptions
-
Exception|AMQPChannelClosedException|AMQPConnectionClosedException|AMQPConnectionBlockedException
Defined by Interface
PublisherInterface
Test Coverage
Information
- Coverage: 34/36 Lines (94.444444444444%)
- Tests: 2
- Passed: 2 (100%)
Tests
- [ PASSED ] — MAKS\AmqpAgent\Tests\Worker\PublisherTest::testPublishBatchAndPublishPublishesMessagesToRabbitMQServerAndOverrideParametersTakeEffect
- [ PASSED ] — MAKS\AmqpAgent\Tests\Worker\PublisherTest::testPublishBatchRaisesAnExceptionIfUnexpectedParameterIsPassed