Nimbus

Nimbus

  • Docs
  • Getting Started
  • Help

›Clients

Documentation

  • Introduction
  • Deployment

Deploying Resources

  • File Storage Bucket
  • Document Store
  • Key-Value Store
  • Relational Database
  • Functions

    • HTTP Function
    • WebSocket Function
    • Document Store Function
    • Key-Value Store Function
    • Notification Function
    • Queue Function
    • Basic Function
    • File Storage Function
    • After Deployment Function
    • Environment Variables

Clients

  • Document Store Client
  • Key-Value Store Client
  • File Storage Client
  • WebSocket Management Client
  • Basic Serverless Function Client
  • Notification Topic Client
  • Queue Client
  • Relational Database Client
  • Environment Variable Client

Local Deployment

  • Unit Testing
  • Local Server

Notification Topic Client

A notification topic client allows you to send notifications to the topic, as well as create and remove subscriptions.

Initialisation

To create a NotificationClient a topic name needs to be supplied, corresponding to the topic that you want to manage.

NotificationClient notificationClient = ClientBuilder.getNotificationClient(topicName);

Additionally any serverless function that uses a NotificationClient must also be annotated with @UsesNotificationTopic(topicName). This needs to be given the name of the topic as well. This gives the function the correct cloud permissions and also will create the notification topic if it does not exist in the project.

In the above examples topicName should be replaced with the name of your topic.

NotificationClient Methods

  • String createSubscription(Protocol protocol, String endpoint) - Creates a subscription, where protocol could be SMS or EMAIL, and endpoint could be "example@nimbusframework.com" or "+441297468216". Returns the subscriptionId. Recommend using some kind of store to keep track of subscriptionIds.

  • notify(String message) - Sends a notification to the topic, which will notify everyone subscribed.

  • notifyJson(Object message) - Sends a notification to the topic, serializing the message provided into JSON.

  • deleteSubscription(String subscriptionId) - Unsubscribes subscription id from the notification topic, so they will no longer be notified.

Annotation Specification

@UsesNotificationTopic

Required Parameters

  • topic - The name of the notification topic the function will interact with.

Optional Parameters

  • stages - The stages that the function will be able to interact with the notification topic.
← Basic Serverless Function ClientQueue Client →
  • Initialisation
  • NotificationClient Methods
  • Annotation Specification
    • @UsesNotificationTopic
Nimbus
Docs
Getting StartedDocumentation
More
GitHubStar
Copyright © 2019 Thomas Allerton