Camel PubNub component

Camel PubNub component can be used to communicate with the PubNub data stream network for connected devices. This component uses pubnub library

Maven dependency

Maven users should add the following dependency to their POM file:

io.rhiotcamel-pubnub${rhiot.version}

Avaliable for rhiot.version >= 0.1.1

General URI format

pubnub://<pubnubEndpointType>:channel[?options]

The following values are currently supported as pubnubEndpointType:

  • pubsub

  • presence

URI Parameters

Operations can be used on the producer endpoint, or as a header:

Consuming:

Route that consumes messages from mychannel:

from("pubnub://pubsub:mychannel?uuid=master&subscriberKey=mysubkey").routeId("my-route")
.to("log:default?showHeaders=true");

Route that listens for presence (eg. join, leave, state change) events on a channel

from("pubnub://presence:mychannel?subscriberKey=mysubkey").routeId("presence-route")
.to("log:default?showHeaders=true");

Producing

Route the collect data and sendt it to pubnub channel mychannel:

from("timer:default?period=2000").routeId("device-event-route")
.bean(EventGeneratorBean.class, "getEvent()")
.convertBodyTo(JSONObject.class)
.to("pubnub://pubsub:mychannel?uuid=deviceuuid&publisherKey=mypubkey");

Last updated