PubSub
in package
[$pubsub = $this->core->loadClass('PubSub');] Class to handle Pub/Sub of GCP
https://cloud.google.com/pubsub/docs/quickstart-client-libraries It requires to execute for testing: gcloud pubsub topics create cloudframework-pubsub-test --project={your-project} gcloud pubsub subscriptions create cloudframework-pubsub-test-sub --topic cloudframework-pubsub-test --project={your-project} https://console.cloud.google.com/cloudpubsub/topic/list?folder=&organizationId=&project={your-project} It requires: Pub/Sub Admin
Table of Contents
Properties
- $client : mixed
- $error : mixed
- $errorMsg : mixed
- $lastMessages : mixed
- $lastSubscription : Subscription
- $subscription : mixed
- $topic : mixed
- $topicName : mixed
- $core : mixed
Methods
- __construct() : mixed
- DataSQL constructor.
- acknowledgeLastMessages() : Topic|null
- getSubscription() : array<string|int, mixed>|void
- Return the $subscription subscriptions for the Application
- getSubscriptions() : array<string|int, mixed>|void
- Return the current subscriptions for the Application
- getTopics() : array<string|int, mixed>|void
- Return the current subscriptions for the Application
- pullMessages() : Topic|null
- pushMessage() : array<string|int, mixed>|void
- Publish a message in a TopicName
- subscribeTo() : Subscription|null
- Create a subscripion https://cloud.google.com/pubsub/docs/samples/pubsub-create-pull-subscription
- unsubscribeTo() : Subscription|null
- DELETE a subscripion https://cloud.google.com/pubsub/docs/samples/pubsub-delete-subscription
- addError() : mixed
- Add Error message
Properties
$client
public
mixed
$client
= \null
PubSubClient|null
$error
public
mixed
$error
= \false
$errorMsg
public
mixed
$errorMsg
= \null
$lastMessages
public
mixed
$lastMessages
= \null
\Google\Cloud\PubSub\Subscription|null
$lastSubscription
public
Subscription
$lastSubscription
= \null
$subscription
public
mixed
$subscription
= \null
$topic
public
mixed
$topic
= \null
\Google\Cloud\PubSub\Topic|null
$topicName
public
mixed
$topicName
= ''
$core
private
mixed
$core
= \null
Methods
__construct()
DataSQL constructor.
public
__construct(Core &$core[, mixed $options = [] ]) : mixed
Parameters
- $core : Core
- $options : mixed = []
acknowledgeLastMessages()
public
acknowledgeLastMessages([ $id = null ]) : Topic|null
Parameters
Return values
Topic|nullgetSubscription()
Return the $subscription subscriptions for the Application
public
getSubscription(mixed $subscription[, mixed $topic = null ]) : array<string|int, mixed>|void
Parameters
- $subscription : mixed
- $topic : mixed = null
Tags
Return values
array<string|int, mixed>|voidgetSubscriptions()
Return the current subscriptions for the Application
public
getSubscriptions() : array<string|int, mixed>|void
Return values
array<string|int, mixed>|voidgetTopics()
Return the current subscriptions for the Application
public
getTopics() : array<string|int, mixed>|void
Return values
array<string|int, mixed>|voidpullMessages()
public
pullMessages(mixed $subscriptionName[, mixed $topicName = null ][, mixed $acknowledge = false ]) : Topic|null
Parameters
- $subscriptionName : mixed
- $topicName : mixed = null
- $acknowledge : mixed = false
Return values
Topic|nullpushMessage()
Publish a message in a TopicName
public
pushMessage( $message[, array<string|int, mixed> $attributes = [] ][, null $topicName = null ]) : array<string|int, mixed>|void
Parameters
Return values
array<string|int, mixed>|voidsubscribeTo()
Create a subscripion https://cloud.google.com/pubsub/docs/samples/pubsub-create-pull-subscription
public
subscribeTo(mixed $subscriptionName, mixed $topicName) : Subscription|null
Parameters
- $subscriptionName : mixed
- $topicName : mixed
Return values
Subscription|nullunsubscribeTo()
DELETE a subscripion https://cloud.google.com/pubsub/docs/samples/pubsub-delete-subscription
public
unsubscribeTo(mixed $subscriptionName, mixed $topicName) : Subscription|null
Parameters
- $subscriptionName : mixed
- $topicName : mixed
Return values
Subscription|nulladdError()
Add Error message
private
addError( $err) : mixed