Skip to content

halon-extras/pubsub

Repository files navigation

Google Cloud Pub/Sub plugin

This plugin is a wrapper for the Google Cloud Pub/Sub library.

Installation

Follow the instructions in our manual to add our package repository and then run the below command.

Ubuntu

apt-get install halon-extras-pubsub

RHEL

yum install halon-extras-pubsub

Configuration

For the configuration schema, see pubsub.schema.json. Below is a sample configuration.

Note that the JSON key file setting (credentials) is optional and Google Application Default Credentials will be used if omitted.

smtpd.yaml

plugins:
  - id: pubsub
    config:
      projects:
        - id: project-id
          topics:
            - topic1
          # credentials: /path/to/keyfile.json

Exported functions

These functions needs to be imported from the extras://pubsub module path.

pubsub_publish(project, topic, message)

Publish a message to a topic asynchronously (Supports HSL suspend functionality).

Params

  • project string - The ID of the project as configured in smtpd.yaml
  • topic string - The topic as configured in smtpd.yaml
  • message string - The message to publish

Returns

A successful publish will return an associative array with a id key that contains the ID of the message. On error an additional error key will be provided with the error message.

Example

import { pubsub_publish } from "extras://pubsub";
echo pubsub_publish("project-id", "topic1", "This is a sample message.");

About

Google Cloud Pub/Sub publish plugin

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors