PubNub FunctionsManaging Module Lifecycle

During the lifecycle of your Module, it may be in one of five states.

The state in which the Module is currently is indicated on the Module dashboard.

StateDefinition
Stopped
None of the Functions in the Module are deployed to the PubNub Data Stream Network (DSN). Messages will NOT be processed by any of Module Functions. However, messages from publishing clients will still be passed to awaiting subscribers.
Running
All Functions in the Module are deployed and operational on the DSN.
Pending
The Module is being deployed in the DSN. This is a transient state – the Module may remain in this state for only a few seconds. In some rare cases, it may take up to 20 seconds to transition out.
Stopping
The Module is being stopped. Similarly to the Pending state, a Module should remain in the Stopping state for only a few seconds.
Failed
The Module failed to deploy. In this case, an error has occurred with one or several Functions in the Module. Check the logs for more information.

You can run a Module by clicking on the Run button displayed at the top of the Module Dashboard UI or the Module Editor.

When you click the Run button:

  • All Function in your Module are deployed.
  • The latest saved version of each Function is deployed. To ensure you are running the latest version of your code, be sure to click the Save button, before clicking Run.

When a Function is deployed to the PubNub DSN, multiple instances of each associated Function are deployed on all PubNub PoPs (datacenters).

Messages usually start being processed within the second the Module is deployed. The status will change to Running when the Module's Functions have been deployed globally. Message processing may begin before the status of the block transitions to Running, as some, but not all nodes in the global DSN have completed their deployments.

A Module is stopped by clicking the Stop button displayed at the top of the the Module Dashboard UI or the Module Editor.

When the Module is stopped, all contained Functions are stopped. Messages on the channels will no longer trigger Functions and will simply be passed through to the awaiting subscribers.

 
  1. The maximum recursion limit you can do is 3 - hops from one Function to another, using publish or fire, you can execute a maximum of three Functions.
  2. The combined maximum number within a single Function execution of KV store operations, XHRs, publish and fire is 3.
 
PubNub Functions provides a rich set of tools, and this documentation does not cover all of the potential situations you may encounter. If you need help with a situation not covered by the documentation, please contact PubNub Support.