|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.module.pubnub.PubNubCloudConnector
@Connector(namespacePrefix="pubnub") public class PubNubCloudConnector
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
| Field Summary | |
|---|---|
static int |
MESSAGE_LIMIT
|
| Constructor Summary | |
|---|---|
PubNubCloudConnector()
Creates a new PubNub connector with no state. |
|
PubNubCloudConnector(String publishKey,
String subscribeKey,
String secretKey)
Creates a new PubHub connector with required state. |
|
PubNubCloudConnector(String publishKey,
String subscribeKey,
String secretKey,
boolean ssl)
Creates a new PubHub connector with required state. |
|
| Method Summary | |
|---|---|
org.codehaus.jackson.node.ObjectNode |
createMessage()
Creates a new Json Object message. |
protected String |
getBaseUrl()
|
String |
getPublishKey()
|
String |
getSecretKey()
|
String |
getSubscribeKey()
|
org.codehaus.jackson.JsonNode |
history(String channel,
int limit)
Load history from a channel. |
void |
init()
|
boolean |
isSsl()
|
org.codehaus.jackson.JsonNode |
publish(String channel,
org.codehaus.jackson.JsonNode jsonMessage)
Send a json message to a channel. |
org.codehaus.jackson.JsonNode |
publish(String channel,
String jsonMessage)
Send a json message to a channel. |
org.codehaus.jackson.JsonNode |
request(String channel,
long timeout)
Makes a blocking request to receive a message on a channel. |
double |
serverTime()
Get the Timestamp from PubNub Cloud. |
void |
setPublishKey(String publishKey)
|
void |
setSecretKey(String secretKey)
|
void |
setSsl(boolean ssl)
|
void |
setSubscribeKey(String subscribeKey)
|
void |
subscribe(String channel,
MessageListener listener)
Register a message listener for a channel. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MESSAGE_LIMIT
| Constructor Detail |
|---|
public PubNubCloudConnector()
#config(String, String, String, boolean)
public PubNubCloudConnector(String publishKey,
String subscribeKey,
String secretKey,
boolean ssl)
publishKey - Your publish key that allows you to send data to the PubNub cloudsubscribeKey - Your subscribe key that allows you to send data to the PubNub cloudsecretKey - The secret key given to you when you created the accountssl - Whether to use SSL or not when communicating with the PubNub cloud
public PubNubCloudConnector(String publishKey,
String subscribeKey,
String secretKey)
publishKey - Your publish key that allows you to send data to the PubNub cloudsubscribeKey - Your subscribe key that allows you to send data to the PubNub cloudsecretKey - The secret key given to you when you created the account| Method Detail |
|---|
public String getPublishKey()
public void setPublishKey(String publishKey)
public String getSubscribeKey()
public void setSubscribeKey(String subscribeKey)
public String getSecretKey()
public void setSecretKey(String secretKey)
public boolean isSsl()
public void setSsl(boolean ssl)
@PostConstruct public void init()
protected String getBaseUrl()
public org.codehaus.jackson.JsonNode publish(String channel,
org.codehaus.jackson.JsonNode jsonMessage)
channel - to publish tojsonMessage - the message to publish
@Operation
public org.codehaus.jackson.JsonNode publish(String channel,
@Parameter(optional=true,defaultValue="#[payload]")
String jsonMessage)
<pubnub:publish channel="mychannel" jsonMessage="world"/>
channel - name to publish the message tojsonMessage - the message to publish
public void subscribe(String channel,
MessageListener listener)
channel - name to listen onlistener - the message callback to invoke when a message is received. there will be one invocation
per message and the invocation on the message listener is guaranteed never to be null.
@Operation
public org.codehaus.jackson.JsonNode request(String channel,
@Parameter(optional=true,defaultValue="5000")
long timeout)
<pubnub:request channel="mychannel"/>
channel - name to read fromtimeout - how long to wait for a message. The value is expressed in milliseconds. specify for
@Operation
public org.codehaus.jackson.JsonNode history(String channel,
int limit)
<pubnub:history channel="mychannel" limit="20"/>
channel - name.limit - history count response.
@Operation public double serverTime()
<pubnub:server-time/>
public org.codehaus.jackson.node.ObjectNode createMessage()
ObjectNode can be used like a Map
to write key/value pairs. Objects can be text, numeric, binary or complex objects
ObjectNode instance.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||