定制 shyam-achuthan/google-cloud 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shyam-achuthan/google-cloud

Composer 安装命令:

composer require shyam-achuthan/google-cloud

包简介

A library for easy access of google cloud platform - PubSub ( Alternative to Amazon SQS )

README 文档

README

An easy to use platform for google pubsub on php

composer require shyam-achuthan/google-cloud

Initializing the library

    $projectId = "<your-google-project-id>";
    $key_file_location = "<path-to-service-account-json-credentials";
    
    $pubsub = new \GoogleCloud\Pubsub($projectId,$key_file_location);
    $pubsub->setTopic("<your-message-topic>");
    $pubsub->setSubscription("<your-pull-subscription-name>");

Sending a message to the queue

      $data = ["name"=>"Shyam",'email'=>"shyam@shyamachuthan.com" ]; // string key value pair data to pass to the queue receiver
      $message = "SEND_USER_WELCOME_EMAIL"; // any text message here am using this string to differentiate the actions on the receiver side
      $response = $pubsub->sendMessage($message,$data);
      $resp = $response;

Receiving queue messages

    $resp = $pubsub->receiveMessages(); 

will return Array of message objects which has three attributes - message_title - [String] the message passed to send message while sending - data - [Array] array of data ( key value pair as passed in sending message ) - handle - [String] unique identifier of the message, the acknoledgement-id which is used to delete the message

Delete a message

    $response = $pubsub->deleteMessage($message->handle);

Receive message do execution and delete message

    $resp = $pubsub->receiveMessages(); 
    foreach($resp as $message){
        // Do what ever executin needed with $message->message_title, $message->data
        $pubsub->deleteMessage($message->handle);
    }

Delete multiple messages together

    $pubsub->deleteMessage($handles); // where handles is array of handle/acknowledgement-ids

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固