org.mule.modules

mule-module-pubnub

1.2
Namespacehttp://www.mulesoft.org/schema/mule/pubnub
Schema Locationhttp://www.mulesoft.org/schema/mule/pubnub/1.0/mule-pubnub.xsd
Version1.0
Minimum Mule Version3.2

Module Overview

PubNub is an Internet-Wide Messaging Service for Real-time Web and Mobile apps and games. PubNub is a massively scalable Real-time Bidirectional Messaging Service in the Cloud.

This connector supports version 3 of the PubNub REST API.

PubNub is a freemium service where users get 5,000 messages per day for free but then have reasonable pricing plans for higher volume usage. For more information go to PubNub: http://pubnub.com

Summary

Configuration
<pubnub:config>
Configure an instance of this module
Message Processors
<pubnub:history>
Load history from a channel.
<pubnub:publish>
Send a json message to a channel.
<pubnub:request>
Makes a blocking request to receive a message on a channel.
<pubnub:server-time>
Get the Timestamp from PubNub Cloud.
Message Sources
<pubnub:subscribe>
Listen for a message on a channel.

Configuration

To use the this module within a flow the namespace to the module must be included. The resulting flow will look similar to the following:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:pubnub="http://www.mulesoft.org/schema/mule/pubnub"
      xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core
               http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.mulesoft.org/schema/mule/pubnub
               http://www.mulesoft.org/schema/mule/pubnub/1.0/mule-pubnub.xsd">

      <!-- here goes your flows and configuration elements -->

</mule>

This module is configured using the config element. This element must be placed outside of your flows and at the root of your Mule application. You can create as many configurations as you deem necesary as long as each carries its own name.

Each message processor, message source or transformer carries a config-ref attribute that allows the invoker to specify which configuration to use.

Attributes
TypeNameDefault ValueDescription
xs:string name Optional. Give a name to this configuration so it can be later referenced.
xs:string publishKey Your publish key that allows you to send data to the PubNub cloud
xs:string secretKey The secret key given to you when you created the account
xs:boolean ssl false Optional. Whether to use SSL or not when communicating with the PubNub cloud
xs:string subscribeKey Your subscribe key that allows you to send data to the PubNub cloud

Message Processors

<pubnub:history>

Load history from a channel.


XML Sample
INCLUDE_ERROR

Attributes
config-ref Optional. Specify which configuration to use.
channel Name.
limit History count response.
retryMax 1 Optional. Specify how many times this operation can be retried automatically
Child Elements
Return Payload
  • JsonNode of history.

<pubnub:publish>

Send a json message to a channel.


XML Sample
INCLUDE_ERROR

Attributes
config-ref Optional. Specify which configuration to use.
channel Name to publish the message to
jsonMessage The message to publish
retryMax 1 Optional. Specify how many times this operation can be retried automatically
Child Elements
Return Payload
  • boolean false on fail.

<pubnub:request>

Makes a blocking request to receive a message on a channel.


XML Sample
INCLUDE_ERROR

Attributes
config-ref Optional. Specify which configuration to use.
channel Name to read from
timeout Optional. How long to wait for a message. The value is expressed in milliseconds. specify for
retryMax 1 Optional. Specify how many times this operation can be retried automatically
Child Elements
Return Payload
  • zero or more messages depending on what was in the queue

<pubnub:server-time>

Get the Timestamp from PubNub Cloud.


XML Sample
INCLUDE_ERROR

Attributes
config-ref Optional. Specify which configuration to use.
retryMax 1 Optional. Specify how many times this operation can be retried automatically
Child Elements
Return Payload
  • double timestamp.

Message Sources

<pubnub:subscribe>

Listen for a message on a channel.

XML Sample
INCLUDE_ERROR

Attributes
config-ref Optional. Specify which configuration to use.
channel Name to listen on
callback Callback to execute when a message comes in
retryMax 1 Optional. Specify how many times this operation can be retried automatically
Child Elements