publishBatch() public method

Example: $topic->publishBatch([ [ 'data' => 'New User Registered', 'attributes' => [ 'id' => 1, 'userName' => 'John', 'location' => 'Detroit' ] ], [ 'data' => 'New User Registered', 'attributes' => [ 'id' => 2, 'userName' => 'Steve', 'location' => 'Mountain View' ] ] ]);
See also: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/publish Publish Message
public publishBatch ( array $messages, array $options = [] ) : array
$messages array A list of messages. Each message must be in the correct [Message Format](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage). If provided, $data will be base64 encoded before being published, unless `$options['encode']` is set to false. (See below for more information.) }
$options array [optional] Configuration Options
return array A list of message IDs.
Example #1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testPublishMalformedMessage()
 {
     $message = ['key' => 'val'];
     $this->connection->publishMessage(Argument::any());
     $topic = new Topic($this->connection->reveal(), 'topic-name', 'project-name');
     $topic->publishBatch([$message]);
 }