Laravel Framework PubSub

620 Views Asked by At

enter image description hereHi I have installed google pubsub library via composer in Laravel Framework

$ composer require google/cloud

Is this the right library for laravel framework. Has anyone used this library and successfully implemented pubsub.

Then I have created the topics and subscription. The Subscription is set as push. Then When I tried to publish the message, I am getting error. In google, I can't find such error been repeated. Here is my code.

use Google\Cloud\PubSub\PubSubClient;
$pubsub = new PubSubClient([
            "projectId" => $projectId
        ]);

// Get an instance of a previously created topic.
$topic = $pubSub->topic('my_topic');

// Publish a message to the topic.
$topic->publish(['data' => 'My new message.']);

enter image description here

1

There are 1 best solutions below

1
On

Publish function must provide at least one of data and attributes members.

enter image description here