You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/04/12 19:56:20 UTC

[01/11] camel git commit: Add more to kit

Repository: camel
Updated Branches:
  refs/heads/master 514840908 -> f9e40f7c4


Add more to kit


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f9e40f7c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f9e40f7c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f9e40f7c

Branch: refs/heads/master
Commit: f9e40f7c4ff9a20408d5dd804953f2e677a25de7
Parents: 6b96ca3
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 21:25:06 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 apache-camel/pom.xml                            | 24 +++++++++++++++++++
 .../src/main/descriptors/common-bin.xml         | 11 ++++-----
 parent/pom.xml                                  | 25 ++++++++++++++++++++
 3 files changed, 53 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f9e40f7c/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index bbbb64e..bd6fad1 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -1291,6 +1291,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-digitalocean-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-disruptor-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -1741,6 +1745,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-milo-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-mina2-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -1876,6 +1885,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-pubnub-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-quartz2-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -1991,6 +2005,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-sjms2-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-slack-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -2239,6 +2258,11 @@
       <artifactId>camel-zookeeper-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-zookeeper-master-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
     <!-- camel catalog and commands -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/f9e40f7c/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index e0c6feb..b108d8e 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -73,7 +73,7 @@
         <include>org.apache.camel:camel-docker</include>
         <include>org.apache.camel:camel-dozer</include>
         <include>org.apache.camel:camel-drill</include>
-	    <include>org.apache.camel:camel-dropbox</include>
+	      <include>org.apache.camel:camel-dropbox</include>
         <include>org.apache.camel:camel-eclipse</include>
         <include>org.apache.camel:camel-ehcache</include>
         <include>org.apache.camel:camel-ejb</include>
@@ -231,12 +231,8 @@
         <include>org.apache.camel:camel-splunk</include>
         <include>org.apache.camel:camel-spring</include>
         <include>org.apache.camel:camel-spring-batch</include>
-        <include>org.apache.camel:camel-spring-boot</include>
-        <include>org.apache.camel:camel-spring-boot-starter</include>
         <include>org.apache.camel:camel-spring-cloud</include>
-        <include>org.apache.camel:camel-spring-cloud-starter</include>
         <include>org.apache.camel:camel-spring-cloud-netflix</include>
-        <include>org.apache.camel:camel-spring-cloud-netflix-starter</include>
         <include>org.apache.camel:camel-spring-dm</include>
         <include>org.apache.camel:camel-spring-integration</include>
         <include>org.apache.camel:camel-spring-javaconfig</include>
@@ -280,7 +276,6 @@
         <include>org.apache.camel:camel-yammer</include>
         <include>org.apache.camel:camel-zipfile</include>
         <include>org.apache.camel:camel-zipkin</include>
-        <include>org.apache.camel:camel-zipkin-starter</include>
         <include>org.apache.camel:camel-zookeeper</include>
         <include>org.apache.camel:camel-zookeeper-master</include>
       </includes>
@@ -505,9 +500,10 @@
         <include>org.apache.camel:camel-spark-starter</include>
         <include>org.apache.camel:camel-splunk-starter</include>
         <include>org.apache.camel:camel-spring-batch-starter</include>
+        <include>org.apache.camel:camel-spring-boot</include>
         <include>org.apache.camel:camel-spring-boot-starter</include>
         <include>org.apache.camel:camel-spring-cloud-starter</include>
-        <include>org.apache.camel:camel-spring-dm-starter</include>
+        <include>org.apache.camel:camel-spring-cloud-netflix-starter</include>
         <include>org.apache.camel:camel-spring-integration-starter</include>
         <include>org.apache.camel:camel-spring-javaconfig-starter</include>
         <include>org.apache.camel:camel-spring-ldap-starter</include>
@@ -544,6 +540,7 @@
         <include>org.apache.camel:camel-zipfile-starter</include>
         <include>org.apache.camel:camel-zipkin-starter</include>
         <include>org.apache.camel:camel-zookeeper-starter</include>
+        <include>org.apache.camel:camel-zookeeper-master-starter</include>
       </includes>
     </dependencySet>
   </dependencySets>

http://git-wip-us.apache.org/repos/asf/camel/blob/f9e40f7c/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 3d0d888..bcd4855 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1494,6 +1494,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-milo</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-mina</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -2828,6 +2833,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-milo-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-mina2-starter</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -2953,6 +2963,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pubnub-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-protobuf-starter</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -3073,6 +3088,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-sjms2-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-slack-starter</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -3321,6 +3341,11 @@
         <artifactId>camel-zookeeper-starter</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-zookeeper-master-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
 
       <!-- testing jars -->
       <dependency>


[02/11] camel git commit: Add more to kit

Posted by da...@apache.org.
Add more to kit


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b1eb86f1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b1eb86f1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b1eb86f1

Branch: refs/heads/master
Commit: b1eb86f1fe604bfec605357da25db77039faae53
Parents: 5f47c85
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 21:22:16 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 apache-camel/pom.xml                             | 8 ++++++++
 apache-camel/src/main/descriptors/common-bin.xml | 3 +++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b1eb86f1/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 285ce04..bbbb64e 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -227,6 +227,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-digitalocean</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-disruptor</artifactId>
     </dependency>
     <dependency>
@@ -622,6 +626,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-milo</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-mina</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/b1eb86f1/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index c320469..e0c6feb 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -162,6 +162,7 @@
         <include>org.apache.camel:camel-lumberjack</include>
         <include>org.apache.camel:camel-lzf</include>
         <include>org.apache.camel:camel-metrics</include>
+        <include>org.apache.camel:camel-milo</include>
         <include>org.apache.camel:camel-mail</include>
         <include>org.apache.camel:camel-mina</include>
         <include>org.apache.camel:camel-mina2</include>
@@ -442,6 +443,7 @@
         <include>org.apache.camel:camel-lzf-starter</include>
         <include>org.apache.camel:camel-mail-starter</include>
         <include>org.apache.camel:camel-metrics-starter</include>
+        <include>org.apache.camel:camel-milo-starter</include>
         <include>org.apache.camel:camel-mina2-starter</include>
         <include>org.apache.camel:camel-mllp-starter</include>
         <include>org.apache.camel:camel-mongodb-gridfs-starter</include>
@@ -469,6 +471,7 @@
         <include>org.apache.camel:camel-pgevent-starter</include>
         <include>org.apache.camel:camel-printer-starter</include>
         <include>org.apache.camel:camel-protobuf-starter</include>
+        <include>org.apache.camel:camel-pubnub-starter</include>
         <include>org.apache.camel:camel-quartz2-starter</include>
         <include>org.apache.camel:camel-quickfix-starter</include>
         <include>org.apache.camel:camel-rabbitmq-starter</include>


[06/11] camel git commit: fixes after review comments

Posted by da...@apache.org.
fixes after review comments

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3bc8d1b1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3bc8d1b1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3bc8d1b1

Branch: refs/heads/master
Commit: 3bc8d1b1d5d4ca2bf6a07584c13cead47b08dd1e
Parents: a070919
Author: Preben Asmussen <pr...@gmail.com>
Authored: Wed Apr 12 10:39:35 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 components/camel-pubnub/pom.xml                 | 26 ++++++++++++--------
 .../src/main/docs/pubnub-component.adoc         | 12 ++++-----
 .../component/pubnub/PubNubConfiguration.java   |  4 +--
 .../camel/component/pubnub/PubNubConsumer.java  |  2 +-
 .../camel/component/pubnub/PubNubEndpoint.java  |  7 ++----
 .../pubnub/PubNubConfigurationTest.java         |  4 +--
 .../camel/component/pubnub/PubNubFireTest.java  |  2 +-
 .../component/pubnub/PubNubPresensTest.java     |  2 +-
 .../component/pubnub/PubNubPublishTest.java     |  2 +-
 .../component/pubnub/PubNubSubscriberTest.java  |  2 +-
 .../example/PubNubGeoLocationExample.java       |  4 +--
 .../pubnub/example/PubNubPresenseExample.java   |  2 +-
 .../pubnub/example/PubNubSensor2Example.java    |  8 +++---
 .../pubnub/example/PubNubSensorExample.java     |  2 +-
 14 files changed, 41 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/pom.xml b/components/camel-pubnub/pom.xml
index 5c831df..2999a2b 100644
--- a/components/camel-pubnub/pom.xml
+++ b/components/camel-pubnub/pom.xml
@@ -1,14 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-  license agreements. See the NOTICE file distributed with this work for additional 
-  information regarding copyright ownership. The ASF licenses this file to 
-  You under the Apache License, Version 2.0 (the "License"); you may not use 
-  this file except in compliance with the License. You may obtain a copy of 
-  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
-  by applicable law or agreed to in writing, software distributed under the 
-  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
-  OF ANY KIND, either express or implied. See the License for the specific 
-  language governing permissions and limitations under the License. -->
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/main/docs/pubnub-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/docs/pubnub-component.adoc b/components/camel-pubnub/src/main/docs/pubnub-component.adoc
index ead5556..9124563 100644
--- a/components/camel-pubnub/src/main/docs/pubnub-component.adoc
+++ b/components/camel-pubnub/src/main/docs/pubnub-component.adoc
@@ -49,7 +49,7 @@ The PubNub component has no options.
 // endpoint options: START
 The PubNub endpoint is configured using URI syntax:
 
-    pubnub://channel
+    pubnub:channel
 
 with the following path and query parameters:
 
@@ -66,19 +66,19 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |=======================================================================
 | Name | Description | Default | Type
-| **pubnub** (common) | Reference to a Pubnub client in the registry. |  | PubNub
-| **secure** (common) | Use ssl | true | boolean
 | **uuid** (common) | UUID to be used as a device identifier a default UUID is generated if not passed. |  | String
 | **bridgeErrorHandler** (consumer) | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN or ERROR level and ignored. | false | boolean
 | **withPresence** (consumer) | Also subscribe to related presence information | false | boolean
 | **exceptionHandler** (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
 | **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
 | **operation** (producer) | The operation to perform. PUBLISH: Default. Send a message to all subscribers of a channel. FIRE: allows the client to send a message to BLOCKS Event Handlers. These messages will go directly to any Event Handlers registered on the channel that you fire to and will trigger their execution HERENOW: Obtain information about the current state of a channel including a list of unique user-ids currently subscribed to the channel and the total occupancy count. WHERENOW: Obtain information about the current list of channels to which a uuid is subscribed to. GETSTATE: Used to get key/value pairs specific to a subscriber uuid. State information is supplied as a JSON object of key/value pairs SETSTATE: Used to set key/value pairs specific to a subscriber uuid GETHISTORY: Fetches historical messages of a channel. |  | String
+| **pubnub** (advanced) | Reference to a Pubnub client in the registry. |  | PubNub
 | **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | **authKey** (security) | If Access Manager is utilized client will use this authKey in all restricted requests. |  | String
 | **cipherKey** (security) | If cipher is passed all communicatons to/from PubNub will be encrypted. |  | String
 | **publishKey** (security) | The publish key obtained from your PubNub account. Required when publishing messages. |  | String
 | **secretKey** (security) | The secret key used for message signing. |  | String
+| **secure** (security) | Use SSL for secure transmission. | true | boolean
 | **subscribeKey** (security) | The subscribe key obtained from your PubNub account. Required when subscribing to channels or listening for presence events |  | String
 |=======================================================================
 // endpoint options: END
@@ -111,7 +111,7 @@ The following snippet publish the event DeviceInfo to the channel iot.
 from("timer:mytimer")
     // generate some data as POJO.
     .bean(PojoBean.class)
-    .to("pubnub://iot?publishKey=mypublishKey");
+    .to("pubnub:iot?publishKey=mypublishKey");
 ----
 
 #### Subscribing to events
@@ -121,7 +121,7 @@ If you can add the option withPresens, you will also receive channel Join, Leave
 
 [source,java]
 ----
-from("pubnub://iot?subscribeKey=mySubscribeKey")
+from("pubnub:iot?subscribeKey=mySubscribeKey")
     .log("${body}")
     .to("mock:result");
 ----
@@ -140,4 +140,4 @@ The example illustrates the PubNub component subscribing to a infinite stream of
 * link:endpoint.html[Endpoint]
 * link:getting-started.html[Getting Started]
 
-* link:rss.html[RSS]
\ No newline at end of file
+* link:rss.html[RSS]

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
index b9a0ad6..d8546b7 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
@@ -44,7 +44,7 @@ public class PubNubConfiguration {
     @UriParam(label = "security", secret = true)
     private String cipherKey;
 
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "security", defaultValue = "true")
     private boolean secure = true;
 
     @UriParam()
@@ -112,7 +112,7 @@ public class PubNubConfiguration {
     }
 
     /**
-     * Use ssl
+     * Use SSL for secure transmission.
      */
     public boolean isSecure() {
         return this.secure;

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
index 2ae6529..3fecaca 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
@@ -105,7 +105,7 @@ public class PubNubConsumer extends DefaultConsumer {
 
         @Override
         public void message(PubNub pubnub, PNMessageResult message) {
-            Exchange exchange = new DefaultExchange(endpoint, endpoint.getExchangePattern());
+            Exchange exchange = endpoint.createExchange();
             Message inmessage = exchange.getIn();
             inmessage.setBody(message);
             inmessage.setHeader(TIMETOKEN, message.getTimetoken());

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
index a592e7a..f7d2c3f 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
@@ -28,10 +28,10 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
 
-@UriEndpoint(scheme = "pubnub", title = "PubNub", syntax = "pubnub://channel", consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
+@UriEndpoint(scheme = "pubnub", title = "PubNub", syntax = "pubnub:channel", consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
 public class PubNubEndpoint extends DefaultEndpoint {
 
-    @UriParam
+    @UriParam(label = "advanced")
     private PubNub pubnub;
 
     @UriParam
@@ -42,8 +42,6 @@ public class PubNubEndpoint extends DefaultEndpoint {
         this.configuration = configuration;
     }
 
-    
-
     @Override
     public Producer createProducer() throws Exception {
         return new PubNubProducer(this, configuration);
@@ -66,7 +64,6 @@ public class PubNubEndpoint extends DefaultEndpoint {
     /**
      * Reference to a Pubnub client in the registry.
      */
-
     public PubNub getPubnub() {
         return pubnub;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
index 12aca16..53193ce 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
@@ -30,7 +30,7 @@ public class PubNubConfigurationTest extends CamelTestSupport {
     @Test
     public void createEndpointWithMinimalConfiguration() throws Exception {
         PubNubComponent component = new PubNubComponent(context);
-        PubNubEndpoint endpoint = (PubNubEndpoint) component.createEndpoint("pubnub://xxx?subscribeKey=mysubkey");
+        PubNubEndpoint endpoint = (PubNubEndpoint) component.createEndpoint("pubnub:xxx?subscribeKey=mysubkey");
 
         assertEquals("xxx", endpoint.getConfiguration().getChannel());
         assertEquals("mysubkey", endpoint.getConfiguration().getSubscribeKey());
@@ -41,7 +41,7 @@ public class PubNubConfigurationTest extends CamelTestSupport {
     public void createEndpointWithMaximalConfiguration() throws Exception {
         PubNubComponent component = new PubNubComponent(context);
         PubNubEndpoint endpoint = (PubNubEndpoint)component
-            .createEndpoint("pubnub://xxx?subscribeKey=mysubkey&publishKey=mypubkey&secretKey=secrets&uuid=myuuid&operation=PUBLISH&secure=false&authKey=authKey");
+            .createEndpoint("pubnub:xxx?subscribeKey=mysubkey&publishKey=mypubkey&secretKey=secrets&uuid=myuuid&operation=PUBLISH&secure=false&authKey=authKey");
 
         assertEquals("xxx", endpoint.getConfiguration().getChannel());
         assertEquals("mysubkey", endpoint.getConfiguration().getSubscribeKey());

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java
index 3407fcd..4a7b002 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java
@@ -29,7 +29,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
 import static org.apache.camel.component.pubnub.PubNubConstants.TIMETOKEN;
 
 public class PubNubFireTest extends PubNubTestBase {
-    private String endpoint = "pubnub://someChannel?operation=fire&pubnub=#pubnub";
+    private String endpoint = "pubnub:someChannel?operation=fire&pubnub=#pubnub";
 
     @EndpointInject(uri = "mock:result")
     private MockEndpoint mockResult;

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
index 775b233..252a894 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
@@ -60,7 +60,7 @@ public class PubNubPresensTest extends PubNubTestBase {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("pubnub://mychannel?pubnub=#pubnub&withPresence=true").id("presence-route")
+                from("pubnub:mychannel?pubnub=#pubnub&withPresence=true").id("presence-route")
                     .autoStartup(false)
                     .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
index 535f25c..199e0f9 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
@@ -31,7 +31,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
 import static org.apache.camel.component.pubnub.PubNubConstants.TIMETOKEN;
 
 public class PubNubPublishTest extends PubNubTestBase {
-    private String endpoint = "pubnub://someChannel?pubnub=#pubnub";
+    private String endpoint = "pubnub:someChannel?pubnub=#pubnub";
 
     @EndpointInject(uri = "mock:result")
     private MockEndpoint mockResult;

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
index 43a4ce8..5202401 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
@@ -51,7 +51,7 @@ public class PubNubSubscriberTest extends PubNubTestBase {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("pubnub://mychannel?pubnub=#pubnub").id("subroute").autoStartup(false)
+                from("pubnub:mychannel?pubnub=#pubnub").id("subroute").autoStartup(false)
                     .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java
index 1efae17..09fb118 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java
@@ -23,9 +23,9 @@ public class PubNubGeoLocationExample {
         public void configure() throws Exception {
             from("timer:geotimer")
                 .process(exchange -> exchange.getIn().setBody(new Foo("bar", "TEXT")))
-                .to("pubnub://eon-maps-geolocation-input?operation=fire&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY);
+                .to("pubnub:eon-maps-geolocation-input?operation=fire&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY);
 
-            from("pubnub://eon-map-geolocation-output?subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
+            from("pubnub:eon-map-geolocation-output?subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
                 .log("${body}");
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
index bb24558..554c4fb 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
@@ -35,7 +35,7 @@ public final class PubNubPresenseExample {
     static class PresensRoute extends RouteBuilder {
         @Override
         public void configure() throws Exception {
-            from("pubnub://iot?withPresence=true&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
+            from("pubnub:iot?withPresence=true&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
                 .log("${body}")
                 .to("mock:result");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
index 74c7d7f..81cb4b8 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
@@ -47,8 +47,8 @@ public final class PubNubSensor2Example {
     }
 
     static class SimulatedDeviceEventGeneratorRoute extends RouteBuilder {
-        private final String deviceEP = "pubnub://iot?uuid=device2&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY;
-        private final String devicePrivateEP = "pubnub://device2private?uuid=device2&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY;
+        private final String deviceEP = "pubnub:iot?uuid=device2&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY;
+        private final String devicePrivateEP = "pubnub:device2private?uuid=device2&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY;
 
         @Override
         public void configure() throws Exception {
@@ -63,7 +63,7 @@ public final class PubNubSensor2Example {
     }
 
     static class PubsubRoute extends RouteBuilder {
-        private static String masterEP = "pubnub://iot?uuid=master&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY + "&publishKey=" + PUBNUB_PUBLISH_KEY;
+        private static String masterEP = "pubnub:iot?uuid=master&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY + "&publishKey=" + PUBNUB_PUBLISH_KEY;
         private static Map<String, String> devices = new ConcurrentHashMap<String, String>();
 
         @Override
@@ -81,7 +81,7 @@ public final class PubNubSensor2Example {
         }
 
         public static class DataProcessorBean {
-            @EndpointInject(uri = "pubnub://iot?uuid=master&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
+            @EndpointInject(uri = "pubnub:iot?uuid=master&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
             private static ProducerTemplate template;
 
             public static String getUnicastChannelOfDevice() {

http://git-wip-us.apache.org/repos/asf/camel/blob/3bc8d1b1/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
index b56b31d..565e069 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
@@ -33,7 +33,7 @@ public final class PubNubSensorExample {
     static class SensorRoute extends RouteBuilder {
         @Override
         public void configure() throws Exception {
-            from("pubnub://pubnub-sensor-network?subscribeKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}").to("mock:result");
+            from("pubnub:pubnub-sensor-network?subscribeKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}").to("mock:result");
         }
     }
 


[09/11] camel git commit: Review fix. Do try .. catch of Exceptions in the producer

Posted by da...@apache.org.
Review fix. Do try .. catch of Exceptions in the producer

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b1f7ea62
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b1f7ea62
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b1f7ea62

Branch: refs/heads/master
Commit: b1f7ea623da2748537d6349ebbea4ed3f220a31a
Parents: 3bc8d1b
Author: Preben Asmussen <pr...@gmail.com>
Authored: Wed Apr 12 17:25:22 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 .../camel/component/pubnub/PubNubProducer.java  | 83 ++++++++++----------
 1 file changed, 43 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b1f7ea62/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
index 4e688d4..bb20e1b 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
@@ -20,6 +20,7 @@ import java.util.Arrays;
 
 import com.pubnub.api.PubNubException;
 import com.pubnub.api.callbacks.PNCallback;
+import com.pubnub.api.models.consumer.PNErrorData;
 import com.pubnub.api.models.consumer.PNPublishResult;
 import com.pubnub.api.models.consumer.PNStatus;
 import com.pubnub.api.models.consumer.history.PNHistoryResult;
@@ -56,43 +57,41 @@ public class PubNubProducer extends DefaultAsyncProducer {
         Operation operation = getOperation(exchange);
 
         LOG.debug("Executing {} operation", operation);
-
-        switch (operation) {
-        case PUBLISH: {
-            doPublish(exchange, callback);
-            break;
-        }
-        case FIRE: {
-            doFire(exchange, callback);
-            break;
-        }
-        case GETHISTORY: {
-            doGetHistory(exchange, callback);
-            break;
-        }
-        case GETSTATE: {
-            doGetState(exchange, callback);
-            break;
-        }
-        case HERENOW: {
-            doHereNow(exchange, callback);
-            break;
-        }
-        case SETSTATE: {
-            doSetState(exchange, callback);
-            break;
-        }
-        case WHERENOW: {
-            doWhereNow(exchange, callback);
-            break;
-        }
-        default:
-            throw new UnsupportedOperationException(operation.toString());
-        }
-        if (exchange.getException() != null) {
-            if (exchange.getException() instanceof PubNubException) {
-                LOG.error("Exception from PubNub : {}", exchange.getException(PubNubException.class).getPubnubError().getMessage());
+        try {
+            switch (operation) {
+            case PUBLISH: {
+                doPublish(exchange, callback);
+                break;
+            }
+            case FIRE: {
+                doFire(exchange, callback);
+                break;
             }
+            case GETHISTORY: {
+                doGetHistory(exchange, callback);
+                break;
+            }
+            case GETSTATE: {
+                doGetState(exchange, callback);
+                break;
+            }
+            case HERENOW: {
+                doHereNow(exchange, callback);
+                break;
+            }
+            case SETSTATE: {
+                doSetState(exchange, callback);
+                break;
+            }
+            case WHERENOW: {
+                doWhereNow(exchange, callback);
+                break;
+            }
+            default:
+                throw new UnsupportedOperationException(operation.toString());
+            }
+        } catch (Exception e) {
+            exchange.setException(e);
             callback.done(true);
             return true;
         }
@@ -103,8 +102,7 @@ public class PubNubProducer extends DefaultAsyncProducer {
     private void doPublish(Exchange exchange, AsyncCallback callback) {
         Object body = exchange.getIn().getBody();
         if (ObjectHelper.isEmpty(body)) {
-            exchange.setException(new CamelException("Can not publish empty message"));
-            callback.done(true);
+            throw new RuntimeException("Can not publish empty message");
         }
         LOG.debug("Sending message [{}] to channel [{}]", body, getChannel(exchange));
         endpoint.getPubnub()
@@ -222,9 +220,14 @@ public class PubNubProducer extends DefaultAsyncProducer {
 
     private void processMessage(Exchange exchange, AsyncCallback callback, PNStatus status, Object body) {
         if (status.isError()) {
-            exchange.setException(status.getErrorData().getThrowable());
+            PNErrorData errorData = status.getErrorData();
             callback.done(false);
-            return;
+            exchange.setException(errorData.getThrowable());
+            if (errorData != null && errorData.getThrowable() instanceof PubNubException) {
+                PubNubException pubNubException = (PubNubException) errorData.getThrowable();
+                throw new RuntimeException(pubNubException.getPubnubError().getMessage(), errorData.getThrowable());
+            }
+            throw new RuntimeException(status.getErrorData().getThrowable());
         }
         if (exchange.getPattern().isOutCapable()) {
             exchange.getOut().copyFrom(exchange.getIn());


[03/11] camel git commit: polished

Posted by da...@apache.org.
polished

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a070919d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a070919d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a070919d

Branch: refs/heads/master
Commit: a070919d3016b980ec7536547801ae7ef25b84b6
Parents: 1304292
Author: Preben Asmussen <pr...@gmail.com>
Authored: Tue Apr 11 10:21:21 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 .../src/main/docs/pubnub-component.adoc         | 143 +++++++++++++++++++
 .../component/pubnub/PubNubConfiguration.java   |  55 ++++---
 .../camel/component/pubnub/PubNubEndpoint.java  |   7 +-
 .../camel/component/pubnub/PubNubProducer.java  |  39 ++---
 .../pubnub/PubNubConfigurationTest.java         |  10 +-
 .../camel/component/pubnub/PubNubFireTest.java  |  69 +++++++++
 .../component/pubnub/PubNubOperationsTest.java  |  12 +-
 .../component/pubnub/PubNubPresensTest.java     |   2 +-
 .../component/pubnub/PubNubPublishTest.java     |   4 +-
 .../component/pubnub/PubNubSubscriberTest.java  |   2 +-
 .../pubnub/example/PubNubExampleConstants.java  |   6 +-
 .../example/PubNubGeoLocationExample.java       |  43 ++++++
 .../pubnub/example/PubNubPresenseExample.java   |   4 +-
 .../pubnub/example/PubNubSensor2Example.java    |  14 +-
 .../pubnub/example/PubNubSensorExample.java     |   2 +-
 .../src/test/resources/log4j2.properties        |   2 +-
 parent/pom.xml                                  |   2 +-
 17 files changed, 348 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/main/docs/pubnub-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/docs/pubnub-component.adoc b/components/camel-pubnub/src/main/docs/pubnub-component.adoc
new file mode 100644
index 0000000..ead5556
--- /dev/null
+++ b/components/camel-pubnub/src/main/docs/pubnub-component.adoc
@@ -0,0 +1,143 @@
+## PubNub Component
+
+*Available as of Camel version *
+
+Camel PubNub component can be used to communicate with the https://www.pubnub.com/[PubNub] data stream network for connected devices. This component uses pubnub https://github.com/pubnub/java[java library].
+
+### Use cases include
+
+** Chat rooms: Sending and receiving messages
+** Locations and Connected cars: dispatching taxi cabs
+** Smart sensors: Receiving data from a sensor for data visualizations
+** Health: Monitoring heart rate from a patient's wearable device
+** Multiplayer gamings
+** Interactive media: audience-participating voting system
+
+
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-pubnub</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+### URI format
+
+[source,java]
+------------------------
+pubnub://channel[?options]
+------------------------
+
+Where *channel* is the PubNub channel to publish or subscribe to.
+
+### Options
+
+
+// component options: START
+The PubNub component has no options.
+// component options: END
+
+
+
+// endpoint options: START
+The PubNub endpoint is configured using URI syntax:
+
+    pubnub://channel
+
+with the following path and query parameters:
+
+#### Path Parameters (1 parameters):
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|=======================================================================
+| Name | Description | Default | Type
+| **channel** | *Required* The channel used for subscribing/publishing events |  | String
+|=======================================================================
+
+#### Query Parameters (14 parameters):
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|=======================================================================
+| Name | Description | Default | Type
+| **pubnub** (common) | Reference to a Pubnub client in the registry. |  | PubNub
+| **secure** (common) | Use ssl | true | boolean
+| **uuid** (common) | UUID to be used as a device identifier a default UUID is generated if not passed. |  | String
+| **bridgeErrorHandler** (consumer) | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN or ERROR level and ignored. | false | boolean
+| **withPresence** (consumer) | Also subscribe to related presence information | false | boolean
+| **exceptionHandler** (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
+| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
+| **operation** (producer) | The operation to perform. PUBLISH: Default. Send a message to all subscribers of a channel. FIRE: allows the client to send a message to BLOCKS Event Handlers. These messages will go directly to any Event Handlers registered on the channel that you fire to and will trigger their execution HERENOW: Obtain information about the current state of a channel including a list of unique user-ids currently subscribed to the channel and the total occupancy count. WHERENOW: Obtain information about the current list of channels to which a uuid is subscribed to. GETSTATE: Used to get key/value pairs specific to a subscriber uuid. State information is supplied as a JSON object of key/value pairs SETSTATE: Used to set key/value pairs specific to a subscriber uuid GETHISTORY: Fetches historical messages of a channel. |  | String
+| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
+| **authKey** (security) | If Access Manager is utilized client will use this authKey in all restricted requests. |  | String
+| **cipherKey** (security) | If cipher is passed all communicatons to/from PubNub will be encrypted. |  | String
+| **publishKey** (security) | The publish key obtained from your PubNub account. Required when publishing messages. |  | String
+| **secretKey** (security) | The secret key used for message signing. |  | String
+| **subscribeKey** (security) | The subscribe key obtained from your PubNub account. Required when subscribing to channels or listening for presence events |  | String
+|=======================================================================
+// endpoint options: END
+
+### Message headers when subscribing
+
+[width="100%",cols="20%,80%",options="header",]
+|=======================================================================
+|Name |Description
+|`CamelPubNubTimeToken` |The Timestamp for the event.
+
+|`CamelPubNubChannel` |The channel for which the message belongs.
+
+### Messsage body
+The message body can contain any JSON serializable data, including: Objects, Arrays, Ints and Strings. Message data should not contain special Java V4 classes or functions as these will not serialize. String content can include any single-byte or multi-byte UTF-8
+
+Object serialization when sending is done automatically. Just pass the full object as the message payload. PubNub will takes care of object serialization.
+
+When receiving the message body utilize objects provided by the PubNub API.
+
+### Use cases
+
+#### Publishing events
+
+Default operation when producing.
+The following snippet publish the event DeviceInfo to the channel iot.
+
+[source,java]
+----
+from("timer:mytimer")
+    // generate some data as POJO.
+    .bean(PojoBean.class)
+    .to("pubnub://iot?publishKey=mypublishKey");
+----
+
+#### Subscribing to events
+
+The following snippet listens for events on the iot channel.
+If you can add the option withPresens, you will also receive channel Join, Leave asf events. 
+
+[source,java]
+----
+from("pubnub://iot?subscribeKey=mySubscribeKey")
+    .log("${body}")
+    .to("mock:result");
+----
+
+There is a couple of examples in test directory that shows some of the PubNub features. 
+They require a PubNub account, from where you can obtain a publish- and subscribe key.
+ 
+The example PubNubSensorExample already contains a subscribe key provided by PubNub, so this is ready to run without a account. 
+The example illustrates the PubNub component subscribing to a infinite stream of sensor data.
+
+
+### See Also
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+
+* link:rss.html[RSS]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
index 65342fa..b9a0ad6 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
@@ -29,25 +29,28 @@ public class PubNubConfiguration {
     @Metadata(required = "true")
     private String channel;
 
-    @UriParam()
-    private String publisherKey;
+    @UriParam(label = "security", secret = true)
+    private String publishKey;
 
-    @UriParam()
-    private String subscriberKey;
+    @UriParam(label = "security", secret = true)
+    private String subscribeKey;
 
-    @UriParam()
+    @UriParam(label = "security", secret = true)
     private String secretKey;
 
-    @UriParam()
+    @UriParam(label = "security", secret = true)
     private String authKey;
 
+    @UriParam(label = "security", secret = true)
+    private String cipherKey;
+
     @UriParam(defaultValue = "true")
     private boolean secure = true;
 
     @UriParam()
     private String uuid;
 
-    @UriParam(label = "producer", enums = "HERE_NOW,WHERE_NOW,GET_STATE,SET_STATE,GET_HISTORY,PUBLISH,FIRE")
+    @UriParam(label = "producer", enums = "HERENOW,WHERENOW,GETSTATE,SETSTATE,GETHISTORY,PUBLISH,FIRE")
     private String operation;
 
     @UriParam(label = "consumer", defaultValue = "false")
@@ -56,23 +59,23 @@ public class PubNubConfiguration {
     /**
      * The publish key obtained from your PubNub account. Required when publishing messages.
      */
-    public String getPublisherKey() {
-        return this.publisherKey;
+    public String getPublishKey() {
+        return this.publishKey;
     }
 
-    public void setPublisherKey(String publisherKey) {
-        this.publisherKey = publisherKey;
+    public void setPublishKey(String publishKey) {
+        this.publishKey = publishKey;
     }
 
     /**
      * The subscribe key obtained from your PubNub account. Required when subscribing to channels or listening for presence events
      */
-    public String getSubscriberKey() {
-        return this.subscriberKey;
+    public String getSubscribeKey() {
+        return this.subscribeKey;
     }
 
-    public void setSubscriberKey(String subscriberKey) {
-        this.subscriberKey = subscriberKey;
+    public void setSubscribeKey(String subscribeKey) {
+        this.subscribeKey = subscribeKey;
     }
 
     /**
@@ -98,6 +101,17 @@ public class PubNubConfiguration {
     }
 
     /**
+     * If cipher is passed, all communicatons to/from PubNub will be encrypted.
+     */
+    public String getCipherKey() {
+        return cipherKey;
+    }
+
+    public void setCipherKey(String cipherKey) {
+        this.cipherKey = cipherKey;
+    }
+
+    /**
      * Use ssl
      */
     public boolean isSecure() {
@@ -120,7 +134,7 @@ public class PubNubConfiguration {
     }
 
     /**
-     * The uuid identifying the connection. Will be auto assigned if not set.
+     * UUID to be used as a device identifier, a default UUID is generated if not passed.
      */
     public void setUuid(String uuid) {
         this.uuid = uuid;
@@ -132,6 +146,15 @@ public class PubNubConfiguration {
 
     /**
      * The operation to perform.
+     * <ul>
+     * <li>PUBLISH: Default. Send a message to all subscribers of a channel.</li>
+     * <li>FIRE: allows the client to send a message to BLOCKS Event Handlers. These messages will go directly to any Event Handlers registered on the channel that you fire to and will trigger their execution,</li>
+     * <li>HERENOW: Obtain information about the current state of a channel including a list of unique user-ids currently subscribed to the channel and the total occupancy count.</li>
+     * <li>WHERENOW: Obtain information about the current list of channels to which a uuid is subscribed to.</li>
+     * <li>GETSTATE: Used to get key/value pairs specific to a subscriber uuid. State information is supplied as a JSON object of key/value pairs</li>
+     * <li>SETSTATE: Used to set key/value pairs specific to a subscriber uuid</li>
+     * <li>GETHISTORY: Fetches historical messages of a channel.</li>
+     * </ul>
      */
     public void setOperation(String operation) {
         this.operation = operation;

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
index a58b41b..a592e7a 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
@@ -28,7 +28,7 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
 
-@UriEndpoint(scheme = "pubnub", title = "PubNub", syntax = "pubnub:endpointType:channel", consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
+@UriEndpoint(scheme = "pubnub", title = "PubNub", syntax = "pubnub://channel", consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
 public class PubNubEndpoint extends DefaultEndpoint {
 
     @UriParam
@@ -93,10 +93,11 @@ public class PubNubEndpoint extends DefaultEndpoint {
     private PubNub getInstance() {
         PubNub answer = null;
         PNConfiguration pnConfiguration = new PNConfiguration();
-        pnConfiguration.setPublishKey(configuration.getPublisherKey());
-        pnConfiguration.setSubscribeKey(configuration.getSubscriberKey());
+        pnConfiguration.setPublishKey(configuration.getPublishKey());
+        pnConfiguration.setSubscribeKey(configuration.getSubscribeKey());
         pnConfiguration.setSecretKey(configuration.getSecretKey());
         pnConfiguration.setAuthKey(configuration.getAuthKey());
+        pnConfiguration.setCipherKey(configuration.getCipherKey());
         pnConfiguration.setSecure(configuration.isSecure());
         if (ObjectHelper.isNotEmpty(configuration.getUuid())) {
             pnConfiguration.setUuid(configuration.getUuid());

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
index 29665e2..4e688d4 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.pubnub;
 
 import java.util.Arrays;
 
+import com.pubnub.api.PubNubException;
 import com.pubnub.api.callbacks.PNCallback;
 import com.pubnub.api.models.consumer.PNPublishResult;
 import com.pubnub.api.models.consumer.PNStatus;
@@ -65,29 +66,36 @@ public class PubNubProducer extends DefaultAsyncProducer {
             doFire(exchange, callback);
             break;
         }
-        case GET_HISTORY: {
+        case GETHISTORY: {
             doGetHistory(exchange, callback);
             break;
         }
-        case GET_STATE: {
+        case GETSTATE: {
             doGetState(exchange, callback);
             break;
         }
-        case HERE_NOW: {
+        case HERENOW: {
             doHereNow(exchange, callback);
             break;
         }
-        case SET_STATE: {
+        case SETSTATE: {
             doSetState(exchange, callback);
             break;
         }
-        case WHERE_NOW: {
+        case WHERENOW: {
             doWhereNow(exchange, callback);
             break;
         }
         default:
             throw new UnsupportedOperationException(operation.toString());
         }
+        if (exchange.getException() != null) {
+            if (exchange.getException() instanceof PubNubException) {
+                LOG.error("Exception from PubNub : {}", exchange.getException(PubNubException.class).getPubnubError().getMessage());
+            }
+            callback.done(true);
+            return true;
+        }
         return false;
     }
 
@@ -138,7 +146,6 @@ public class PubNubProducer extends DefaultAsyncProducer {
     }
 
     private void doGetHistory(Exchange exchange, AsyncCallback callback) {
-        // @formatter:off
         endpoint.getPubnub()
             .history()
             .channel(getChannel(exchange))
@@ -149,7 +156,6 @@ public class PubNubProducer extends DefaultAsyncProducer {
                     processMessage(exchange, callback, status, result.getMessages());
                 }
             });
-    // @formatter:on
     }
 
     private void doSetState(Exchange exchange, AsyncCallback callback) {
@@ -173,7 +179,6 @@ public class PubNubProducer extends DefaultAsyncProducer {
     }
 
     private void doGetState(Exchange exchange, AsyncCallback callback) {
-        // @formatter:off
         endpoint.getPubnub()
             .getPresenceState()
             .channels(Arrays.asList(getChannel(exchange)))
@@ -185,7 +190,6 @@ public class PubNubProducer extends DefaultAsyncProducer {
                     processMessage(exchange, callback, status, result.getStateByUUID());
                 }
             });
-    // @formatter:on
     }
 
     private void doHereNow(Exchange exchange, AsyncCallback callback) {
@@ -204,7 +208,6 @@ public class PubNubProducer extends DefaultAsyncProducer {
     }
 
     private void doWhereNow(Exchange exchange, AsyncCallback callback) {
-        // @formatter:off
         endpoint.getPubnub()
             .whereNow()
             .uuid(getUUID(exchange))
@@ -215,21 +218,19 @@ public class PubNubProducer extends DefaultAsyncProducer {
                     processMessage(exchange, callback, status, result.getChannels());
                 };
             });
-        // @formatter:on
     }
 
     private void processMessage(Exchange exchange, AsyncCallback callback, PNStatus status, Object body) {
         if (status.isError()) {
             exchange.setException(status.getErrorData().getThrowable());
-            callback.done(true);
-        } else if (body != null) {
-            exchange.getIn().setBody(body);
+            callback.done(false);
+            return;
         }
         if (exchange.getPattern().isOutCapable()) {
             exchange.getOut().copyFrom(exchange.getIn());
-            if (body != null) {
-                exchange.getOut().setBody(body);
-            }
+            exchange.getOut().setBody(body);
+        } else {
+            exchange.getIn().setBody(body);
         }
 
         // signal exchange completion
@@ -241,7 +242,7 @@ public class PubNubProducer extends DefaultAsyncProducer {
         if (operation == null) {
             operation = pubnubConfiguration.getOperation();
         }
-        return operation != null ? Operation.valueOf(operation) : Operation.PUBLISH;
+        return operation != null ? Operation.valueOf(operation.toUpperCase()) : Operation.PUBLISH;
     }
 
     private String getChannel(Exchange exchange) {
@@ -255,6 +256,6 @@ public class PubNubProducer extends DefaultAsyncProducer {
     }
 
     private enum Operation {
-        HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH, FIRE;
+        HERENOW, WHERENOW, GETSTATE, SETSTATE, GETHISTORY, PUBLISH, FIRE;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
index 20ddd24..12aca16 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
@@ -30,10 +30,10 @@ public class PubNubConfigurationTest extends CamelTestSupport {
     @Test
     public void createEndpointWithMinimalConfiguration() throws Exception {
         PubNubComponent component = new PubNubComponent(context);
-        PubNubEndpoint endpoint = (PubNubEndpoint) component.createEndpoint("pubnub:xxx?subscriberKey=mysubkey");
+        PubNubEndpoint endpoint = (PubNubEndpoint) component.createEndpoint("pubnub://xxx?subscribeKey=mysubkey");
 
         assertEquals("xxx", endpoint.getConfiguration().getChannel());
-        assertEquals("mysubkey", endpoint.getConfiguration().getSubscriberKey());
+        assertEquals("mysubkey", endpoint.getConfiguration().getSubscribeKey());
         assertTrue(endpoint.getConfiguration().isSecure());
     }
 
@@ -41,11 +41,11 @@ public class PubNubConfigurationTest extends CamelTestSupport {
     public void createEndpointWithMaximalConfiguration() throws Exception {
         PubNubComponent component = new PubNubComponent(context);
         PubNubEndpoint endpoint = (PubNubEndpoint)component
-            .createEndpoint("pubnub:xxx?subscriberKey=mysubkey&publisherKey=mypubkey&secretKey=secrets&uuid=myuuid&operation=PUBLISH&secure=false&authKey=authKey");
+            .createEndpoint("pubnub://xxx?subscribeKey=mysubkey&publishKey=mypubkey&secretKey=secrets&uuid=myuuid&operation=PUBLISH&secure=false&authKey=authKey");
 
         assertEquals("xxx", endpoint.getConfiguration().getChannel());
-        assertEquals("mysubkey", endpoint.getConfiguration().getSubscriberKey());
-        assertEquals("mypubkey", endpoint.getConfiguration().getPublisherKey());
+        assertEquals("mysubkey", endpoint.getConfiguration().getSubscribeKey());
+        assertEquals("mypubkey", endpoint.getConfiguration().getPublishKey());
         assertEquals("secrets", endpoint.getConfiguration().getSecretKey());
         assertEquals("myuuid", endpoint.getConfiguration().getUuid());
         assertEquals("PUBLISH", endpoint.getConfiguration().getOperation());

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java
new file mode 100644
index 0000000..3407fcd
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubFireTest.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+import static org.apache.camel.component.pubnub.PubNubConstants.TIMETOKEN;
+
+public class PubNubFireTest extends PubNubTestBase {
+    private String endpoint = "pubnub://someChannel?operation=fire&pubnub=#pubnub";
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockResult;
+
+    @Test
+    public void testFire() throws Exception {
+        stubFor(get(urlPathEqualTo("/publish/myPublishKey/mySubscribeKey/0/someChannel/0/%22Hi%22"))
+            .willReturn(aResponse().withBody("[1,\"Sent\",\"14598111595318003\"]")));
+        mockResult.expectedMessageCount(1);
+        mockResult.expectedHeaderReceived(TIMETOKEN, "14598111595318003");
+
+        template.sendBody("direct:publish", "Hi");
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:publish").to(endpoint).to("mock:result");
+            }
+        };
+    }
+
+    static class Hello {
+        private String message;
+
+        Hello(String message) {
+            this.message = message;
+        }
+
+        public String getMessage() {
+            return message;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
index d0406db..4258ff1 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
@@ -44,7 +44,7 @@ public class PubNubOperationsTest extends PubNubTestBase {
             .willReturn(aResponse().withBody("{\"status\": 200, \"message\": \"OK\", \"payload\": {\"channels\": [\"channel-a\",\"channel-b\"]}, \"service\": \"Presence\"}")));
 
         Map<String, Object> headers = new HashMap<String, Object>();
-        headers.put(PubNubConstants.OPERATION, "WHERE_NOW");
+        headers.put(PubNubConstants.OPERATION, "WHERENOW");
         headers.put(PubNubConstants.UUID, "myUUID");
         @SuppressWarnings("unchecked")
         List<String> response = template.requestBodyAndHeaders("direct:publish", null, headers, List.class);
@@ -60,7 +60,7 @@ public class PubNubOperationsTest extends PubNubTestBase {
                       + "\"uuid\" : \"myUUID1\"}, {\"uuid\" : \"b9eb408c-bcec-4d34-b4c4-fabec057ad0d\"}, {\"state\" : {\"abcd\" : {\"age\" : 15}}, \"uuid\" : \"myUUID2\"},"
                       + " {\"state\" : {\"abcd\" : {\"age\" : 24}}, \"uuid\" : \"myUUID9\"}], \"occupancy\" : 5} Return Occupancy O")));
         Map<String, Object> headers = new HashMap<String, Object>();
-        headers.put(PubNubConstants.OPERATION, "HERE_NOW");
+        headers.put(PubNubConstants.OPERATION, "HERENOW");
         PNHereNowResult response = template.requestBodyAndHeaders("direct:publish", null, headers, PNHereNowResult.class);
         assertNotNull(response);
         assertEquals(5, response.getTotalOccupancy());
@@ -95,7 +95,7 @@ public class PubNubOperationsTest extends PubNubTestBase {
         stubFor(get(urlPathEqualTo("/v2/history/sub-key/mySubscribeKey/channel/myChannel")).willReturn(aResponse().withBody(getPubnub().getMapper().toJson(testArray))));
 
         Map<String, Object> headers = new HashMap<String, Object>();
-        headers.put(PubNubConstants.OPERATION, "GET_HISTORY");
+        headers.put(PubNubConstants.OPERATION, "GETHISTORY");
         @SuppressWarnings("unchecked")
         List<PNHistoryItemResult> response = template.requestBodyAndHeaders("direct:publish", null, headers, List.class);
         assertNotNull(response);
@@ -108,7 +108,7 @@ public class PubNubOperationsTest extends PubNubTestBase {
             .withBody("{ \"status\": 200, \"message\": \"OK\", \"payload\": "
                       + "{ \"myChannel\": { \"age\" : 20, \"status\" : \"online\"}, \"ch2\": { \"age\": 100, \"status\": \"offline\" } }, \"service\": \"Presence\"}")));
         Map<String, Object> headers = new HashMap<String, Object>();
-        headers.put(PubNubConstants.OPERATION, "GET_STATE");
+        headers.put(PubNubConstants.OPERATION, "GETSTATE");
         @SuppressWarnings("unchecked")
         Map<String, JsonObject> response = template.requestBodyAndHeaders("direct:publish", null, headers, Map.class);
         assertNotNull(response);
@@ -122,7 +122,7 @@ public class PubNubOperationsTest extends PubNubTestBase {
         Map<String, Object> myState = new HashMap<>();
         myState.put("age", 20);
         Map<String, Object> headers = new HashMap<String, Object>();
-        headers.put(PubNubConstants.OPERATION, "SET_STATE");
+        headers.put(PubNubConstants.OPERATION, "SETSTATE");
         PNSetStateResult response = template.requestBodyAndHeaders("direct:publish", myState, headers, PNSetStateResult.class);
         assertNotNull(response);
         assertNotNull(response.getState());
@@ -133,7 +133,7 @@ public class PubNubOperationsTest extends PubNubTestBase {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:publish").to("pubnub:myChannel?uuid=myuuid&pubnub=#pubnub")
+                from("direct:publish").to("pubnub://myChannel?uuid=myuuid&pubnub=#pubnub")
                     .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
index 252a894..775b233 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
@@ -60,7 +60,7 @@ public class PubNubPresensTest extends PubNubTestBase {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("pubnub:mychannel?pubnub=#pubnub&withPresence=true").id("presence-route")
+                from("pubnub://mychannel?pubnub=#pubnub&withPresence=true").id("presence-route")
                     .autoStartup(false)
                     .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
index 8b3d9f0..535f25c 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
@@ -31,7 +31,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
 import static org.apache.camel.component.pubnub.PubNubConstants.TIMETOKEN;
 
 public class PubNubPublishTest extends PubNubTestBase {
-    private String endpoint = "pubnub:someChannel?pubnub=#pubnub";
+    private String endpoint = "pubnub://someChannel?pubnub=#pubnub";
 
     @EndpointInject(uri = "mock:result")
     private MockEndpoint mockResult;
@@ -59,7 +59,7 @@ public class PubNubPublishTest extends PubNubTestBase {
     }
 
     @Test
-    public void testFire() throws Exception {
+    public void testFireWithOperationHeader() throws Exception {
         stubFor(get(urlPathEqualTo("/publish/myPublishKey/mySubscribeKey/0/someChannel/0/%22Hi%22"))
             .willReturn(aResponse().withBody("[1,\"Sent\",\"14598111595318003\"]")));
         mockResult.expectedMessageCount(1);

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
index 5202401..43a4ce8 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
@@ -51,7 +51,7 @@ public class PubNubSubscriberTest extends PubNubTestBase {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("pubnub:mychannel?pubnub=#pubnub").id("subroute").autoStartup(false)
+                from("pubnub://mychannel?pubnub=#pubnub").id("subroute").autoStartup(false)
                     .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
index 4e7209d..0df8957 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
@@ -17,8 +17,8 @@
 package org.apache.camel.component.pubnub.example;
 
 public interface PubNubExampleConstants {
-    // replace subscriber+publisher key with one obtained from PubNub.
+    // replace subscribe+publish key with one obtained from PubNub.
     // http://www.pubnub.com
-    String PUBNUB_SUBSCRIBER_KEY = "subkey";
-    String PUBNUB_PUBLISHER_KEY = "pubkey";
+    String PUBNUB_SUBSCRIBE_KEY = "mysubkey";
+    String PUBNUB_PUBLISH_KEY = "mypubkey";
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java
new file mode 100644
index 0000000..1efae17
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubGeoLocationExample.java
@@ -0,0 +1,43 @@
+package org.apache.camel.component.pubnub.example;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.main.Main;
+
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_PUBLISH_KEY;
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_SUBSCRIBE_KEY;
+
+/**
+ * Example of the use of GeoLocation Blocks https://www.pubnub.com/blocks-catalog/geolocation/
+ */
+
+public class PubNubGeoLocationExample {
+
+    public static void main(String[] args) throws Exception {
+        Main main = new Main();
+        main.addRouteBuilder(new GeoLocationRoute());
+        main.run();
+    }
+
+    static class GeoLocationRoute extends RouteBuilder {
+        @Override
+        public void configure() throws Exception {
+            from("timer:geotimer")
+                .process(exchange -> exchange.getIn().setBody(new Foo("bar", "TEXT")))
+                .to("pubnub://eon-maps-geolocation-input?operation=fire&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY);
+
+            from("pubnub://eon-map-geolocation-output?subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
+                .log("${body}");
+        }
+    }
+
+    static class Foo {
+        String foo;
+        String text;
+
+        public Foo(String foo, String text) {
+            super();
+            this.foo = foo;
+            this.text = text;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
index faac12c..bb24558 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.pubnub.example;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.main.Main;
 
-import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_SUBSCRIBE_KEY;
 
 public final class PubNubPresenseExample {
 
@@ -35,7 +35,7 @@ public final class PubNubPresenseExample {
     static class PresensRoute extends RouteBuilder {
         @Override
         public void configure() throws Exception {
-            from("pubnub:iot?withPresence=true&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY)
+            from("pubnub://iot?withPresence=true&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
                 .log("${body}")
                 .to("mock:result");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
index 7389193..74c7d7f 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
@@ -31,8 +31,8 @@ import org.apache.camel.main.Main;
 
 import static org.apache.camel.component.pubnub.PubNubConstants.OPERATION;
 import static org.apache.camel.component.pubnub.PubNubConstants.UUID;
-import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_PUBLISHER_KEY;
-import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_PUBLISH_KEY;
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_SUBSCRIBE_KEY;
 
 public final class PubNubSensor2Example {
 
@@ -47,8 +47,8 @@ public final class PubNubSensor2Example {
     }
 
     static class SimulatedDeviceEventGeneratorRoute extends RouteBuilder {
-        private final String deviceEP = "pubnub:iot?uuid=device2&publisherKey=" + PUBNUB_PUBLISHER_KEY + "&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY;
-        private final String devicePrivateEP = "pubnub:device2private?uuid=device2&publisherKey=" + PUBNUB_PUBLISHER_KEY + "&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY;
+        private final String deviceEP = "pubnub://iot?uuid=device2&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY;
+        private final String devicePrivateEP = "pubnub://device2private?uuid=device2&publishKey=" + PUBNUB_PUBLISH_KEY + "&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY;
 
         @Override
         public void configure() throws Exception {
@@ -63,7 +63,7 @@ public final class PubNubSensor2Example {
     }
 
     static class PubsubRoute extends RouteBuilder {
-        private static String masterEP = "pubnub:iot?uuid=master&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY + "&publisherKey=" + PUBNUB_PUBLISHER_KEY;
+        private static String masterEP = "pubnub://iot?uuid=master&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY + "&publishKey=" + PUBNUB_PUBLISH_KEY;
         private static Map<String, String> devices = new ConcurrentHashMap<String, String>();
 
         @Override
@@ -81,7 +81,7 @@ public final class PubNubSensor2Example {
         }
 
         public static class DataProcessorBean {
-            @EndpointInject(uri = "pubnub:iot?uuid=master&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY)
+            @EndpointInject(uri = "pubnub://iot?uuid=master&subscribeKey=" + PUBNUB_SUBSCRIBE_KEY)
             private static ProducerTemplate template;
 
             public static String getUnicastChannelOfDevice() {
@@ -94,7 +94,7 @@ public final class PubNubSensor2Example {
                 deviceUUID = message.getPublisher();
                 if (devices.get(deviceUUID) == null) {
                     Map<String, Object> headers = new HashMap<String, Object>();
-                    headers.put(OPERATION, "WHERE_NOW");
+                    headers.put(OPERATION, "WHERENOW");
                     headers.put(UUID, deviceUUID);
                     @SuppressWarnings("unchecked")
                     java.util.List<String> channels = (java.util.List<String>) template.requestBodyAndHeaders(null, headers);

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
index f5cff83..b56b31d 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
@@ -33,7 +33,7 @@ public final class PubNubSensorExample {
     static class SensorRoute extends RouteBuilder {
         @Override
         public void configure() throws Exception {
-            from("pubnub:pubnub-sensor-network?subscriberKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}").to("mock:result");
+            from("pubnub://pubnub-sensor-network?subscribeKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}").to("mock:result");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/components/camel-pubnub/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/resources/log4j2.properties b/components/camel-pubnub/src/test/resources/log4j2.properties
index fbb9b06..25b59c8 100644
--- a/components/camel-pubnub/src/test/resources/log4j2.properties
+++ b/components/camel-pubnub/src/test/resources/log4j2.properties
@@ -25,4 +25,4 @@ appender.out.name = out
 appender.out.layout.type = PatternLayout
 appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
 rootLogger.level = INFO
-rootLogger.appenderRef.file.ref = out
+rootLogger.appenderRef.file.ref = file

http://git-wip-us.apache.org/repos/asf/camel/blob/a070919d/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 0b46f85..b84caad 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -517,7 +517,7 @@
     <pgjdbc-ng-driver-version>0.7.1</pgjdbc-ng-driver-version>
     <powermock-version>1.6.6</powermock-version>
     <protobuf-version>3.1.0</protobuf-version>
-    <pubnub-version>4.6.0</pubnub-version>
+    <pubnub-version>4.6.1</pubnub-version>
     <qpid-bundle-version>0.28_1</qpid-bundle-version>
     <qpid-proton-j-version>0.16.0</qpid-proton-j-version>
     <qpid-proton-j-bundle-version>0.14.0</qpid-proton-j-bundle-version>


[08/11] camel git commit: refactor component and upgrade PubNub library

Posted by da...@apache.org.
refactor component and upgrade PubNub library


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/13042923
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/13042923
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/13042923

Branch: refs/heads/master
Commit: 13042923d6451cfb3e3fa0eb7449aa309b9dce04
Parents: 289a672
Author: Preben Asmussen <pr...@gmail.com>
Authored: Sun Apr 2 14:27:09 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 components/camel-pubnub/pom.xml                 |  27 ++-
 .../camel/component/pubnub/JsonConverter.java   |  46 ----
 .../camel/component/pubnub/PubNubComponent.java |  16 +-
 .../component/pubnub/PubNubConfiguration.java   |  61 +++--
 .../camel/component/pubnub/PubNubConstants.java |  10 +-
 .../camel/component/pubnub/PubNubConsumer.java  |  89 ++++---
 .../camel/component/pubnub/PubNubEndpoint.java  | 163 ++-----------
 .../component/pubnub/PubNubEndpointType.java    |  32 ---
 .../camel/component/pubnub/PubNubProducer.java  | 242 ++++++++++++++-----
 .../services/org/apache/camel/TypeConverter     |  18 --
 .../component/pubnub/PubNubComponentTest.java   |  61 -----
 .../pubnub/PubNubConfigurationTest.java         |  29 +--
 .../pubnub/PubNubEmptyPayloadTest.java          |  55 -----
 .../camel/component/pubnub/PubNubMock.java      | 186 --------------
 .../component/pubnub/PubNubOperationsTest.java  | 110 ++++++---
 .../component/pubnub/PubNubPresensTest.java     |  50 ++--
 .../component/pubnub/PubNubPublishTest.java     |  93 +++++++
 .../component/pubnub/PubNubSubscriberTest.java  |  60 +++++
 .../camel/component/pubnub/PubNubTestBase.java  | 107 ++++++++
 .../pubnub/example/PubNubExampleConstants.java  |   4 +-
 .../pubnub/example/PubNubOperationsExample.java |  61 -----
 .../pubnub/example/PubNubPresenseExample.java   |   6 +-
 .../pubnub/example/PubNubSensor2Example.html    | 143 ++++++-----
 .../pubnub/example/PubNubSensor2Example.java    |  82 ++++---
 .../pubnub/example/PubNubSensorExample.java     |   2 +-
 .../src/test/resources/log4j2.properties        |   2 +-
 parent/pom.xml                                  |   2 +-
 .../spring-boot/components-starter/pom.xml      |   1 +
 28 files changed, 840 insertions(+), 918 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/pom.xml b/components/camel-pubnub/pom.xml
index 268cb2a..5c831df 100644
--- a/components/camel-pubnub/pom.xml
+++ b/components/camel-pubnub/pom.xml
@@ -37,7 +37,7 @@
     </dependency>
     <dependency>
       <groupId>com.pubnub</groupId>
-      <artifactId>pubnub</artifactId>
+      <artifactId>pubnub-gson</artifactId>
       <version>${pubnub-version}</version>
     </dependency>
     <dependency>
@@ -45,16 +45,24 @@
       <artifactId>gson</artifactId>
       <version>${gson-version}</version>
     </dependency>
+    
+    <!-- logging -->       
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-      <version>${commons-lang3-version}</version>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20160810</version>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
     </dependency>
+    
     <!-- testing -->
     <dependency>
       <groupId>org.apache.camel</groupId>
@@ -72,8 +80,9 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-netty-http</artifactId>
+      <groupId>com.github.tomakehurst</groupId>
+      <artifactId>wiremock</artifactId>
+      <version>${wiremock-version}</version>
       <scope>test</scope>
     </dependency>
   </dependencies>

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java
deleted file mode 100644
index e5f09a0..0000000
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.pubnub;
-
-import org.apache.camel.Converter;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-@Converter
-public final class JsonConverter {
-    private JsonConverter() {
-    }
-
-    @Converter
-    public static JSONObject toJsonObject(String json) {
-        try {
-            return new JSONObject(json);
-        } catch (JSONException e) {
-            return null;
-        }
-    }
-
-    @Converter
-    public static JSONArray toJsonArray(String json) {
-        try {
-            return new JSONArray(json);
-        } catch (JSONException e) {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
index 9eb4e61..b35e05d 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * Represents the component that manages {@link PubNubEndpoint}.
@@ -37,17 +38,12 @@ public class PubNubComponent extends DefaultComponent {
 
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
-        String[] uriParts = remaining.split(":");
-        if (uriParts.length != 2) {
-            throw new IllegalArgumentException("Invalid Endpoint URI: " + uri + ". It should contains a valid endpointType and channel");
-        }
-        PubNubEndpointType endpointType = PubNubEndpointType.valueOf(uriParts[0]);
-        String channel = uriParts[1];
-
-        PubNubEndpoint endpoint = new PubNubEndpoint(uri, this);
+        ObjectHelper.notNull(remaining, "channel");
+        PubNubConfiguration pubNubConfiguration = new PubNubConfiguration();
+        pubNubConfiguration.setChannel(remaining);
+        setProperties(pubNubConfiguration, parameters);
+        PubNubEndpoint endpoint = new PubNubEndpoint(uri, this, pubNubConfiguration);
         setProperties(endpoint, parameters);
-        endpoint.setEndpointType(endpointType);
-        endpoint.setChannel(channel);
         return endpoint;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
index b506508..65342fa 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.pubnub;
 
-import com.pubnub.api.Pubnub;
 
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
@@ -25,12 +24,6 @@ import org.apache.camel.spi.UriPath;
 
 @UriParams
 public class PubNubConfiguration {
-    @UriParam
-    private Pubnub pubnub;
-
-    @UriPath(enums = "pubsub,presence")
-    @Metadata(required = "true", defaultValue = "pubsub")
-    private PubNubEndpointType endpointType = PubNubEndpointType.pubsub;
 
     @UriPath()
     @Metadata(required = "true")
@@ -45,24 +38,26 @@ public class PubNubConfiguration {
     @UriParam()
     private String secretKey;
 
+    @UriParam()
+    private String authKey;
+
     @UriParam(defaultValue = "true")
-    private boolean ssl = true;
+    private boolean secure = true;
 
     @UriParam()
     private String uuid;
 
-    @UriParam(label = "producer", enums = "HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH")
+    @UriParam(label = "producer", enums = "HERE_NOW,WHERE_NOW,GET_STATE,SET_STATE,GET_HISTORY,PUBLISH,FIRE")
     private String operation;
 
-    public PubNubEndpointType getEndpointType() {
-        return endpointType;
-    }
+    @UriParam(label = "consumer", defaultValue = "false")
+    private boolean withPresence;
 
     /**
      * The publish key obtained from your PubNub account. Required when publishing messages.
      */
     public String getPublisherKey() {
-        return publisherKey;
+        return this.publisherKey;
     }
 
     public void setPublisherKey(String publisherKey) {
@@ -73,7 +68,7 @@ public class PubNubConfiguration {
      * The subscribe key obtained from your PubNub account. Required when subscribing to channels or listening for presence events
      */
     public String getSubscriberKey() {
-        return subscriberKey;
+        return this.subscriberKey;
     }
 
     public void setSubscriberKey(String subscriberKey) {
@@ -84,7 +79,7 @@ public class PubNubConfiguration {
      * The secret key used for message signing.
      */
     public String getSecretKey() {
-        return secretKey;
+        return this.secretKey;
     }
 
     public void setSecretKey(String secretKey) {
@@ -92,21 +87,32 @@ public class PubNubConfiguration {
     }
 
     /**
+     * If Access Manager is utilized, client will use this authKey in all restricted requests.
+     */
+    public String getAuthKey() {
+        return authKey;
+    }
+
+    public void setAuthKey(String authKey) {
+        this.authKey = authKey;
+    }
+
+    /**
      * Use ssl
      */
-    public boolean isSsl() {
-        return ssl;
+    public boolean isSecure() {
+        return this.secure;
     }
 
-    public void setSsl(boolean ssl) {
-        this.ssl = ssl;
+    public void setSecure(boolean secure) {
+        this.secure = secure;
     }
 
     /**
      * The channel used for subscribing/publishing events
      */
     public String getChannel() {
-        return channel;
+        return this.channel;
     }
 
     public void setChannel(String channel) {
@@ -121,7 +127,7 @@ public class PubNubConfiguration {
     }
 
     public String getUuid() {
-        return uuid;
+        return this.uuid;
     }
 
     /**
@@ -132,15 +138,18 @@ public class PubNubConfiguration {
     }
 
     public String getOperation() {
-        return operation;
+        return this.operation;
     }
 
-    public Pubnub getPubnub() {
-        return pubnub;
+    /**
+     * Also subscribe to related presence information
+     */
+    public void setWithPresence(boolean withPresence) {
+        this.withPresence = withPresence;
     }
 
-    public void setPubnub(Pubnub pubnub) {
-        this.pubnub = pubnub;
+    public boolean withPresence() {
+        return withPresence;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java
index 30adae0..9bfdb58 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java
@@ -16,9 +16,9 @@
  */
 package org.apache.camel.component.pubnub;
 
-public interface PubNubConstants {
-    String OPERATION = "CamelPubNubOperation";
-    String TIMETOKEN = "CamelPubNubTimeToken";
-    String CHANNEL = "CamelPubNubChannel";
-    String UUID = "CamelPubNubUUID";
+public abstract class PubNubConstants {
+    public static String OPERATION = "CamelPubNubOperation";
+    public static String TIMETOKEN = "CamelPubNubTimeToken";
+    public static String CHANNEL = "CamelPubNubChannel";
+    public static String UUID = "CamelPubNubUUID";
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
index 8b8002a..2ae6529 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
@@ -16,8 +16,14 @@
  */
 package org.apache.camel.component.pubnub;
 
-import com.pubnub.api.Callback;
-import com.pubnub.api.PubnubError;
+
+import java.util.Arrays;
+
+import com.pubnub.api.PubNub;
+import com.pubnub.api.callbacks.SubscribeCallback;
+import com.pubnub.api.models.consumer.PNStatus;
+import com.pubnub.api.models.consumer.pubsub.PNMessageResult;
+import com.pubnub.api.models.consumer.pubsub.PNPresenceEventResult;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -27,31 +33,37 @@ import org.apache.camel.impl.DefaultExchange;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- * The PubNub consumer.
- */
+import static com.pubnub.api.enums.PNStatusCategory.PNTimeoutCategory;
+import static com.pubnub.api.enums.PNStatusCategory.PNUnexpectedDisconnectCategory;
+
+import static org.apache.camel.component.pubnub.PubNubConstants.CHANNEL;
+import static org.apache.camel.component.pubnub.PubNubConstants.TIMETOKEN;
+
 public class PubNubConsumer extends DefaultConsumer {
     private static final Logger LOG = LoggerFactory.getLogger(PubNubConsumer.class);
     private final PubNubEndpoint endpoint;
+    private final PubNubConfiguration pubNubConfiguration;
 
-    public PubNubConsumer(PubNubEndpoint endpoint, Processor processor) {
+    public PubNubConsumer(PubNubEndpoint endpoint, Processor processor, PubNubConfiguration pubNubConfiguration) {
         super(endpoint, processor);
         this.endpoint = endpoint;
+        this.pubNubConfiguration = pubNubConfiguration;
     }
 
     private void initCommunication() throws Exception {
-        if (endpoint.getEndpointType().equals(PubNubEndpointType.pubsub)) {
-            endpoint.getPubnub().subscribe(endpoint.getChannel(), new PubNubCallback());
+        endpoint.getPubnub().addListener(new PubNubCallback());
+        if (pubNubConfiguration.withPresence()) {
+            endpoint.getPubnub().subscribe().channels(Arrays.asList(pubNubConfiguration.getChannel())).withPresence().execute();
         } else {
-            endpoint.getPubnub().presence(endpoint.getChannel(), new PubNubCallback());
+            endpoint.getPubnub().subscribe().channels(Arrays.asList(pubNubConfiguration.getChannel())).execute();
         }
     }
 
-    private void terminateCommunication() throws Exception {
-        if (endpoint.getEndpointType().equals(PubNubEndpointType.pubsub)) {
-            endpoint.getPubnub().unsubscribe(endpoint.getChannel());
-        } else {
-            endpoint.getPubnub().unsubscribePresence(endpoint.getChannel());
+    private void terminateCommunication() {
+        try {
+            endpoint.getPubnub().unsubscribe().channels(Arrays.asList(pubNubConfiguration.getChannel())).execute();
+        } catch (Exception e) {
+            // ignore
         }
     }
 
@@ -79,15 +91,25 @@ public class PubNubConsumer extends DefaultConsumer {
         super.doSuspend();
     }
 
-    private class PubNubCallback extends Callback {
+    class PubNubCallback extends SubscribeCallback {
 
         @Override
-        public void successCallback(String channel, Object objectMessage, String timetoken) {
+        public void status(PubNub pubnub, PNStatus status) {
+            if (status.getCategory() == PNUnexpectedDisconnectCategory || status.getCategory() == PNTimeoutCategory) {
+                LOG.trace("Got status : {}. Reconnecting to PubNub", status);
+                pubnub.reconnect();
+            } else {
+                LOG.trace("Status message : {}", status);
+            }
+        }
+
+        @Override
+        public void message(PubNub pubnub, PNMessageResult message) {
             Exchange exchange = new DefaultExchange(endpoint, endpoint.getExchangePattern());
-            Message message = exchange.getIn();
-            message.setBody(objectMessage);
-            message.setHeader(PubNubConstants.TIMETOKEN, timetoken);
-            message.setHeader(PubNubConstants.CHANNEL, channel);
+            Message inmessage = exchange.getIn();
+            inmessage.setBody(message);
+            inmessage.setHeader(TIMETOKEN, message.getTimetoken());
+            inmessage.setHeader(CHANNEL, message.getChannel());
             try {
                 getProcessor().process(exchange);
             } catch (Exception e) {
@@ -97,24 +119,21 @@ public class PubNubConsumer extends DefaultConsumer {
         }
 
         @Override
-        public void connectCallback(String channel, Object message) {
-            LOG.info("Subscriber : Successfully connected to PubNub channel {}", channel);
-        }
-
-        @Override
-        public void errorCallback(String channel, PubnubError error) {
-            LOG.error("Subscriber : Error [{}] received from PubNub on channel {}", error, channel);
-        }
+        public void presence(PubNub pubnub, PNPresenceEventResult presence) {
+            Exchange exchange = new DefaultExchange(endpoint, endpoint.getExchangePattern());
+            Message inmessage = exchange.getIn();
+            inmessage.setBody(presence);
+            inmessage.setHeader(TIMETOKEN, presence.getTimetoken());
+            inmessage.setHeader(CHANNEL, presence.getChannel());
+            try {
+                getProcessor().process(exchange);
+            } catch (Exception e) {
+                exchange.setException(e);
+                getExceptionHandler().handleException("Error processing exchange", exchange, e);
+            }
 
-        @Override
-        public void reconnectCallback(String channel, Object message) {
-            LOG.info("Subscriber : Reconnected to PubNub channel {}", channel);
         }
 
-        @Override
-        public void disconnectCallback(String channel, Object message) {
-            LOG.trace("Subscriber : Disconnected from PubNub channel {}", channel);
-        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
index 2f60d2a..a58b41b 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
@@ -16,64 +16,42 @@
  */
 package org.apache.camel.component.pubnub;
 
-import com.pubnub.api.Pubnub;
+
+import com.pubnub.api.PNConfiguration;
+import com.pubnub.api.PubNub;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.ObjectHelper;
 
 @UriEndpoint(scheme = "pubnub", title = "PubNub", syntax = "pubnub:endpointType:channel", consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
 public class PubNubEndpoint extends DefaultEndpoint {
 
     @UriParam
-    private Pubnub pubnub;
-
-    @UriPath(enums = "pubsub,presence")
-    @Metadata(required = "true")
-    private PubNubEndpointType endpointType = PubNubEndpointType.pubsub;
-
-    @UriPath()
-    @Metadata(required = "true")
-    private String channel;
-
-    @UriParam()
-    private String publisherKey;
-
-    @UriParam()
-    private String subscriberKey;
-
-    @UriParam()
-    private String secretKey;
-
-    @UriParam(defaultValue = "true")
-    private boolean ssl = true;
-
-    @UriParam()
-    private String uuid;
+    private PubNub pubnub;
 
-    @UriParam(label = "producer", enums = "HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH")
-    private String operation;
+    @UriParam
+    private PubNubConfiguration configuration;
 
-    public PubNubEndpoint(String uri, PubNubComponent component) {
+    public PubNubEndpoint(String uri, PubNubComponent component, PubNubConfiguration configuration) {
         super(uri, component);
+        this.configuration = configuration;
     }
 
     
 
     @Override
     public Producer createProducer() throws Exception {
-        return new PubNubProducer(this);
+        return new PubNubProducer(this, configuration);
     }
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        return new PubNubConsumer(this, processor);
+        return new PubNubConsumer(this, processor, configuration);
     }
 
     @Override
@@ -81,106 +59,19 @@ public class PubNubEndpoint extends DefaultEndpoint {
         return true;
     }
 
-    /**
-     * The type endpoint type. Either pubsub or presence
-     */
-
-    public PubNubEndpointType getEndpointType() {
-        return endpointType;
-    }
-
-    public void setEndpointType(PubNubEndpointType endpointType) {
-        this.endpointType = endpointType;
-    }
-
-    /**
-     * The pubnub publish key obtained from your pubnub account. Required when
-     * publishing messages.
-     */
-    public String getPublisherKey() {
-        return publisherKey;
-    }
-
-    public void setPublisherKey(String publisherKey) {
-        this.publisherKey = publisherKey;
-    }
-
-    /**
-     * The pubnub subscribe key obtained from your pubnub account. Required when
-     * subscribing to channels or listening for presence events
-     */
-    public String getSubscriberKey() {
-        return subscriberKey;
-    }
-
-    public void setSubscriberKey(String subscriberKey) {
-        this.subscriberKey = subscriberKey;
-    }
-
-    /**
-     * The pubnub secret key used for message signing.
-     */
-    public String getSecretKey() {
-        return secretKey;
-    }
-
-    public void setSecretKey(String secretKey) {
-        this.secretKey = secretKey;
-    }
-
-    /**
-     * Use ssl
-     */
-    public boolean isSsl() {
-        return ssl;
-    }
-
-    public void setSsl(boolean ssl) {
-        this.ssl = ssl;
-    }
-
-    /**
-     * The channel used for subscribing/publishing events
-     */
-    public String getChannel() {
-        return channel;
-    }
-
-    public void setChannel(String channel) {
-        this.channel = channel;
-    }
-
-    /**
-     * The uuid identifying the connection. Will be auto assigned if not set.
-     */
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    public String getUuid() {
-        return uuid;
-    }
-
-    /**
-     * The operation to perform.
-     */
-    public void setOperation(String operation) {
-        this.operation = operation;
-    }
-
-    public String getOperation() {
-        return operation;
+    public PubNubConfiguration getConfiguration() {
+        return configuration;
     }
 
     /**
      * Reference to a Pubnub client in the registry.
      */
 
-    public Pubnub getPubnub() {
+    public PubNub getPubnub() {
         return pubnub;
     }
 
-    public void setPubnub(Pubnub pubnub) {
+    public void setPubnub(PubNub pubnub) {
         this.pubnub = pubnub;
     }
 
@@ -188,7 +79,7 @@ public class PubNubEndpoint extends DefaultEndpoint {
     protected void doStop() throws Exception {
         super.doStop();
         if (pubnub != null) {
-            pubnub.shutdown();
+            pubnub.destroy();
             pubnub = null;
         }
     }
@@ -199,20 +90,18 @@ public class PubNubEndpoint extends DefaultEndpoint {
         super.doStart();
     }
 
-    private Pubnub getInstance() {
-        Pubnub answer = null;
-        if (ObjectHelper.isNotEmpty(getSecretKey())) {
-            answer = new Pubnub(getPublisherKey(), getSubscriberKey(), getSecretKey(), isSsl());
-        } else {
-            answer = new Pubnub(getPublisherKey(), getSubscriberKey(), isSsl());
-        }
-        if (ObjectHelper.isNotEmpty(getUuid())) {
-            answer.setUUID(getUuid());
-        } else {
-            String autoUUID = answer.uuid();
-            setUuid(autoUUID);
-            answer.setUUID(autoUUID);
+    private PubNub getInstance() {
+        PubNub answer = null;
+        PNConfiguration pnConfiguration = new PNConfiguration();
+        pnConfiguration.setPublishKey(configuration.getPublisherKey());
+        pnConfiguration.setSubscribeKey(configuration.getSubscriberKey());
+        pnConfiguration.setSecretKey(configuration.getSecretKey());
+        pnConfiguration.setAuthKey(configuration.getAuthKey());
+        pnConfiguration.setSecure(configuration.isSecure());
+        if (ObjectHelper.isNotEmpty(configuration.getUuid())) {
+            pnConfiguration.setUuid(configuration.getUuid());
         }
+        answer = new PubNub(pnConfiguration);
         return answer;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java
deleted file mode 100644
index 1454b33..0000000
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.pubnub;
-
-public enum PubNubEndpointType {
-    pubsub("pubsub"), presence("presence");
-
-    private final String text;
-
-    PubNubEndpointType(final String text) {
-        this.text = text;
-    }
-
-    @Override
-    public String toString() {
-        return text;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
index c2fb85c..29665e2 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
@@ -16,17 +16,22 @@
  */
 package org.apache.camel.component.pubnub;
 
-import com.pubnub.api.Callback;
-import com.pubnub.api.PubnubError;
+import java.util.Arrays;
+
+import com.pubnub.api.callbacks.PNCallback;
+import com.pubnub.api.models.consumer.PNPublishResult;
+import com.pubnub.api.models.consumer.PNStatus;
+import com.pubnub.api.models.consumer.history.PNHistoryResult;
+import com.pubnub.api.models.consumer.presence.PNGetStateResult;
+import com.pubnub.api.models.consumer.presence.PNHereNowResult;
+import com.pubnub.api.models.consumer.presence.PNSetStateResult;
+import com.pubnub.api.models.consumer.presence.PNWhereNowResult;
 
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.CamelException;
 import org.apache.camel.Exchange;
-import org.apache.camel.InvalidPayloadException;
 import org.apache.camel.impl.DefaultAsyncProducer;
 import org.apache.camel.util.ObjectHelper;
-import org.json.JSONArray;
-import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,72 +41,48 @@ import org.slf4j.LoggerFactory;
 public class PubNubProducer extends DefaultAsyncProducer {
     private static final Logger LOG = LoggerFactory.getLogger(PubNubProducer.class);
     private final PubNubEndpoint endpoint;
+    private final PubNubConfiguration pubnubConfiguration;
 
-    public PubNubProducer(PubNubEndpoint endpoint) {
+    public PubNubProducer(PubNubEndpoint endpoint, PubNubConfiguration pubNubConfiguration) {
         super(endpoint);
         this.endpoint = endpoint;
+        this.pubnubConfiguration = pubNubConfiguration;
     }
 
     @Override
     public boolean process(final Exchange exchange, final AsyncCallback callback) {
-        Callback pubnubCallback = pubnubCallback(exchange, callback);
 
         Operation operation = getOperation(exchange);
-        LOG.trace("Executing {} operation", operation);
+
+        LOG.debug("Executing {} operation", operation);
+
         switch (operation) {
         case PUBLISH: {
-            String channel = exchange.getIn().getHeader(PubNubConstants.CHANNEL, String.class);
-            channel = channel != null ? channel : endpoint.getChannel();
-            Object body = exchange.getIn().getBody();
-            if (ObjectHelper.isEmpty(body)) {
-                exchange.setException(new CamelException("Can not publish empty message"));
-                callback.done(true);
-                return true;
-            }
-            LOG.trace("Sending message [{}] to channel [{}]", body, channel);
-            if (body.getClass().isAssignableFrom(JSONObject.class)) {
-                endpoint.getPubnub().publish(channel, (JSONObject)body, pubnubCallback);
-            } else if (body.getClass().isAssignableFrom(JSONArray.class)) {
-                endpoint.getPubnub().publish(channel, (JSONArray)body, pubnubCallback);
-            } else {
-                try {
-                    endpoint.getPubnub().publish(channel, exchange.getIn().getMandatoryBody(String.class), pubnubCallback);
-                } catch (InvalidPayloadException e) {
-                    exchange.setException(e);
-                    callback.done(true);
-                    return true;
-                }
-            }
+            doPublish(exchange, callback);
+            break;
+        }
+        case FIRE: {
+            doFire(exchange, callback);
             break;
         }
         case GET_HISTORY: {
-            endpoint.getPubnub().history(endpoint.getChannel(), false, pubnubCallback);
+            doGetHistory(exchange, callback);
             break;
         }
         case GET_STATE: {
-            String uuid = exchange.getIn().getHeader(PubNubConstants.UUID, String.class);
-            endpoint.getPubnub().getState(endpoint.getChannel(), uuid != null ? uuid : endpoint.getUuid(), pubnubCallback);
+            doGetState(exchange, callback);
             break;
         }
         case HERE_NOW: {
-            endpoint.getPubnub().hereNow(endpoint.getChannel(), true, true, pubnubCallback);
+            doHereNow(exchange, callback);
             break;
         }
         case SET_STATE: {
-            try {
-                JSONObject state = exchange.getIn().getMandatoryBody(JSONObject.class);
-                String uuid = exchange.getIn().getHeader(PubNubConstants.UUID, String.class);
-                endpoint.getPubnub().setState(endpoint.getChannel(), uuid != null ? uuid : endpoint.getUuid(), state, pubnubCallback);
-            } catch (InvalidPayloadException e) {
-                exchange.setException(e);
-                callback.done(true);
-                return true;
-            }
+            doSetState(exchange, callback);
             break;
         }
         case WHERE_NOW: {
-            String uuid = exchange.getIn().getHeader(PubNubConstants.UUID, String.class);
-            endpoint.getPubnub().whereNow(uuid != null ? uuid : endpoint.getUuid(), pubnubCallback);
+            doWhereNow(exchange, callback);
             break;
         }
         default:
@@ -110,37 +91,170 @@ public class PubNubProducer extends DefaultAsyncProducer {
         return false;
     }
 
-    private Callback pubnubCallback(final Exchange exchange, final AsyncCallback callback) {
-        Callback pubnubCallback = new Callback() {
-            @Override
-            public void successCallback(String channel, Object message) {
-                LOG.trace("PubNub response {}", message);
-                exchange.getIn().setHeader(PubNubConstants.CHANNEL, channel);
-                if (exchange.getPattern().isOutCapable()) {
-                    exchange.getOut().copyFrom(exchange.getIn());
-                    exchange.getOut().setBody(message);
+
+    private void doPublish(Exchange exchange, AsyncCallback callback) {
+        Object body = exchange.getIn().getBody();
+        if (ObjectHelper.isEmpty(body)) {
+            exchange.setException(new CamelException("Can not publish empty message"));
+            callback.done(true);
+        }
+        LOG.debug("Sending message [{}] to channel [{}]", body, getChannel(exchange));
+        endpoint.getPubnub()
+            .publish()
+            .message(body)
+            .channel(getChannel(exchange))
+            .usePOST(true)
+            .async(new PNCallback<PNPublishResult>() {
+                @Override
+                public void onResponse(PNPublishResult result, PNStatus status) {
+                    if (!status.isError()) {
+                        exchange.getIn().setHeader(PubNubConstants.TIMETOKEN, result.getTimetoken());
+                    }
+                    processMessage(exchange, callback, status, null);
                 }
-                callback.done(false);
-            }
+            });
+    }
+
+    private void doFire(Exchange exchange, AsyncCallback callback) {
+        Object body = exchange.getIn().getBody();
+        if (ObjectHelper.isEmpty(body)) {
+            exchange.setException(new CamelException("Can not fire empty message"));
+            callback.done(true);
+        }
+        LOG.debug("Sending message [{}] to channel [{}]", body, getChannel(exchange));
+        endpoint.getPubnub()
+            .fire()
+            .message(body)
+            .channel(getChannel(exchange))
+            .async(new PNCallback<PNPublishResult>() {
+                @Override
+                public void onResponse(PNPublishResult result, PNStatus status) {
+                    if (!status.isError()) {
+                        exchange.getIn().setHeader(PubNubConstants.TIMETOKEN, result.getTimetoken());
+                    }
+                    processMessage(exchange, callback, status, null);
+                }
+            });
+    }
+
+    private void doGetHistory(Exchange exchange, AsyncCallback callback) {
+        // @formatter:off
+        endpoint.getPubnub()
+            .history()
+            .channel(getChannel(exchange))
+            .async(new PNCallback<PNHistoryResult>() {
+                @Override
+                public void onResponse(PNHistoryResult result, PNStatus status) {
+                    LOG.debug("Got history message [{}]", result);
+                    processMessage(exchange, callback, status, result.getMessages());
+                }
+            });
+    // @formatter:on
+    }
+
+    private void doSetState(Exchange exchange, AsyncCallback callback) {
+        Object body = exchange.getIn().getBody();
+        if (ObjectHelper.isEmpty(body)) {
+            exchange.setException(new CamelException("Can not publish empty message"));
+            callback.done(true);
+        }
+        LOG.debug("Sending setState [{}] to channel [{}]", body, getChannel(exchange));
+        endpoint.getPubnub()
+            .setPresenceState()
+            .channels(Arrays.asList(getChannel(exchange)))
+            .state(body)
+            .uuid(getUUID(exchange))
+            .async(new PNCallback<PNSetStateResult>() {
+                public void onResponse(PNSetStateResult result, PNStatus status) {
+                    LOG.debug("Got setState responsee [{}]", result);
+                    processMessage(exchange, callback, status, result);
+                };
+            });
+    }
+
+    private void doGetState(Exchange exchange, AsyncCallback callback) {
+        // @formatter:off
+        endpoint.getPubnub()
+            .getPresenceState()
+            .channels(Arrays.asList(getChannel(exchange)))
+            .uuid(getUUID(exchange))
+            .async(new PNCallback<PNGetStateResult>() {
+                @Override
+                public void onResponse(PNGetStateResult result, PNStatus status) {
+                    LOG.debug("Got state [{}]", result.getStateByUUID());
+                    processMessage(exchange, callback, status, result.getStateByUUID());
+                }
+            });
+    // @formatter:on
+    }
+
+    private void doHereNow(Exchange exchange, AsyncCallback callback) {
+        endpoint.getPubnub()
+            .hereNow()
+            .channels(Arrays.asList(getChannel(exchange)))
+            .includeState(true)
+            .includeUUIDs(true)
+            .async(new PNCallback<PNHereNowResult>() {
+                @Override
+                public void onResponse(PNHereNowResult result, PNStatus status) {
+                    LOG.debug("Got herNow message [{}]", result);
+                    processMessage(exchange, callback, status, result);
+                }
+            });
+    }
 
-            @Override
-            public void errorCallback(String channel, PubnubError error) {
-                exchange.setException(new CamelException(error.toString()));
-                callback.done(false);
+    private void doWhereNow(Exchange exchange, AsyncCallback callback) {
+        // @formatter:off
+        endpoint.getPubnub()
+            .whereNow()
+            .uuid(getUUID(exchange))
+            .async(new PNCallback<PNWhereNowResult>() {
+                @Override
+                public void onResponse(PNWhereNowResult result, PNStatus status) {
+                    LOG.debug("Got whereNow message [{}]", result.getChannels());
+                    processMessage(exchange, callback, status, result.getChannels());
+                };
+            });
+        // @formatter:on
+    }
+
+    private void processMessage(Exchange exchange, AsyncCallback callback, PNStatus status, Object body) {
+        if (status.isError()) {
+            exchange.setException(status.getErrorData().getThrowable());
+            callback.done(true);
+        } else if (body != null) {
+            exchange.getIn().setBody(body);
+        }
+        if (exchange.getPattern().isOutCapable()) {
+            exchange.getOut().copyFrom(exchange.getIn());
+            if (body != null) {
+                exchange.getOut().setBody(body);
             }
-        };
-        return pubnubCallback;
+        }
+
+        // signal exchange completion
+        callback.done(false);
     }
 
     private Operation getOperation(Exchange exchange) {
         String operation = exchange.getIn().getHeader(PubNubConstants.OPERATION, String.class);
         if (operation == null) {
-            operation = endpoint.getOperation();
+            operation = pubnubConfiguration.getOperation();
         }
         return operation != null ? Operation.valueOf(operation) : Operation.PUBLISH;
     }
 
+    private String getChannel(Exchange exchange) {
+        String channel = exchange.getIn().getHeader(PubNubConstants.CHANNEL, String.class);
+        return channel != null ? channel : pubnubConfiguration.getChannel();
+    }
+
+    private String getUUID(Exchange exchange) {
+        String uuid = exchange.getIn().getHeader(PubNubConstants.UUID, String.class);
+        return uuid != null ? uuid : pubnubConfiguration.getUuid();
+    }
+
     private enum Operation {
-        HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH;
+        HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH, FIRE;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
deleted file mode 100644
index ebdd694..0000000
--- a/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.camel.component.pubnub
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java
deleted file mode 100644
index 664bafe..0000000
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.pubnub;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.json.JSONObject;
-import org.junit.Test;
-
-public class PubNubComponentTest extends CamelTestSupport {
-    private String endpoint = "pubnub:pubsub:someChannel?pubnub=#pubnub";
-
-    @EndpointInject(uri = "mock:result")
-    private MockEndpoint mockResult;
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
-        return registry;
-    }
-
-    @Test
-    public void testPubNub() throws Exception {
-        mockResult.expectedMessageCount(1);
-        mockResult.expectedHeaderReceived("CamelPubNubChannel", "someChannel");
-        mockResult.expectedBodiesReceived("{\"hi\":\"there\"}");
-        JSONObject jo = new JSONObject();
-        jo.put("hi", "there");
-        template.sendBody("direct:publish", jo);
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() {
-                from(endpoint).to("mock:result");
-                from("direct:publish").to(endpoint);
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
index 23e5c56..20ddd24 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
@@ -24,32 +24,33 @@ public class PubNubConfigurationTest extends CamelTestSupport {
     @Test(expected = IllegalArgumentException.class)
     public void createEndpointWithIllegalArguments() throws Exception {
         PubNubComponent component = new PubNubComponent(context);
-        component.createEndpoint("pubnub:XXX:xxx");
+        component.createEndpoint("pubnub");
     }
 
     @Test
     public void createEndpointWithMinimalConfiguration() throws Exception {
         PubNubComponent component = new PubNubComponent(context);
-        PubNubEndpoint endpoint = (PubNubEndpoint) component.createEndpoint("pubnub://pubsub:xxx?subscriberKey=mysubkey");
+        PubNubEndpoint endpoint = (PubNubEndpoint) component.createEndpoint("pubnub:xxx?subscriberKey=mysubkey");
 
-        assertEquals("xxx", endpoint.getChannel());
-        assertEquals("mysubkey", endpoint.getSubscriberKey());
-        assertTrue(endpoint.isSsl());
+        assertEquals("xxx", endpoint.getConfiguration().getChannel());
+        assertEquals("mysubkey", endpoint.getConfiguration().getSubscriberKey());
+        assertTrue(endpoint.getConfiguration().isSecure());
     }
 
     @Test
     public void createEndpointWithMaximalConfiguration() throws Exception {
         PubNubComponent component = new PubNubComponent(context);
         PubNubEndpoint endpoint = (PubNubEndpoint)component
-            .createEndpoint("pubnub://pubsub:xxx?subscriberKey=mysubkey&publisherKey=mypubkey&secretKey=secrets&uuid=myuuid&operation=PUBLISH&ssl=false");
-
-        assertEquals("xxx", endpoint.getChannel());
-        assertEquals("mysubkey", endpoint.getSubscriberKey());
-        assertEquals("mypubkey", endpoint.getPublisherKey());
-        assertEquals("secrets", endpoint.getSecretKey());
-        assertEquals("myuuid", endpoint.getUuid());
-        assertEquals("PUBLISH", endpoint.getOperation());
-        assertFalse(endpoint.isSsl());
+            .createEndpoint("pubnub:xxx?subscriberKey=mysubkey&publisherKey=mypubkey&secretKey=secrets&uuid=myuuid&operation=PUBLISH&secure=false&authKey=authKey");
+
+        assertEquals("xxx", endpoint.getConfiguration().getChannel());
+        assertEquals("mysubkey", endpoint.getConfiguration().getSubscriberKey());
+        assertEquals("mypubkey", endpoint.getConfiguration().getPublisherKey());
+        assertEquals("secrets", endpoint.getConfiguration().getSecretKey());
+        assertEquals("myuuid", endpoint.getConfiguration().getUuid());
+        assertEquals("PUBLISH", endpoint.getConfiguration().getOperation());
+        assertEquals("authKey", endpoint.getConfiguration().getAuthKey());
+        assertFalse(endpoint.getConfiguration().isSecure());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java
deleted file mode 100644
index d641259..0000000
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.pubnub;
-
-import org.apache.camel.CamelExecutionException;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class PubNubEmptyPayloadTest extends CamelTestSupport {
-    private final String endpoint = "pubnub:pubsub:someChannel?pubnub=#pubnub";
-
-    @EndpointInject(uri = "mock:result")
-    private MockEndpoint mockResult;
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
-        return registry;
-    }
-
-    @Test(expected = CamelExecutionException.class)
-    public void testPubNub() throws Exception {
-        template.sendBody("direct:publish", null);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() {
-                from("direct:publish").to(endpoint);
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java
deleted file mode 100644
index f7b6917..0000000
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.pubnub;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import com.pubnub.api.Callback;
-import com.pubnub.api.Pubnub;
-import com.pubnub.api.PubnubException;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-public class PubNubMock extends Pubnub {
-    private static Map<String, Callback> subscribers = new ConcurrentHashMap<String, Callback>();
-    private static Map<String, Callback> presenceSubscribers = new ConcurrentHashMap<String, Callback>();
-    private static Map<String, JSONObject> stateMap = new ConcurrentHashMap<String, JSONObject>();
-    private final ExecutorService executorService = Executors.newFixedThreadPool(3);
-
-    public PubNubMock(String publishKey, String subscribeKey) {
-        super(publishKey, subscribeKey);
-    }
-
-    @Override
-    public void subscribe(String channel, Callback callback) throws PubnubException {
-        subscribers.put(channel, callback);
-        executorService.execute(() -> {
-            try {
-                Thread.sleep(500);
-                callback.connectCallback(channel, "OK");
-            } catch (InterruptedException e) {
-            }
-        });
-        Callback presenceCallback = presenceSubscribers.get(channel);
-        if (presenceCallback != null) {
-            executorService.execute(() -> {
-                try {
-                    Thread.sleep(500);
-                    String presence = "{\"action\":\"join\",\"timestamp\":1431777382,\"uuid\":\"d08f121b-d146-45af-a814-058c1b7d283a\",\"occupancy\":1}";
-                    presenceCallback.successCallback(channel, new JSONObject(presence), "" + System.currentTimeMillis());
-                } catch (Exception e) {
-                }
-            });
-        }
-    }
-
-    @Override
-    public void publish(String channel, JSONObject message, Callback callback) {
-        callback.successCallback(channel, "OK");
-        Callback clientMockCallback = subscribers.get(channel);
-        if (clientMockCallback != null) {
-            executorService.execute(() -> {
-                try {
-                    Thread.sleep(1000);
-                    clientMockCallback.successCallback(channel, message, "" + System.currentTimeMillis());
-                } catch (InterruptedException e) {
-                }
-            });
-        }
-    }
-
-    @Override
-    public void publish(String channel, JSONArray message, Callback callback) {
-        callback.successCallback(channel, "OK");
-        Callback clientMockCallback = subscribers.get(channel);
-        if (clientMockCallback != null) {
-            executorService.execute(() -> {
-                try {
-                    Thread.sleep(1000);
-                    clientMockCallback.successCallback(channel, message, "" + System.currentTimeMillis());
-                } catch (InterruptedException e) {
-                }
-            });
-        }
-    }
-
-    @Override
-    public void publish(String channel, String message, Callback callback) {
-        callback.successCallback(channel, "OK");
-        Callback clientMockCallback = subscribers.get(channel);
-        if (clientMockCallback != null) {
-            executorService.execute(() -> {
-                try {
-                    Thread.sleep(1000);
-                    clientMockCallback.successCallback(channel, message, "" + System.currentTimeMillis());
-                } catch (InterruptedException e) {
-                }
-            });
-        }
-    }
-
-    @Override
-    public void presence(String channel, Callback callback) throws PubnubException {
-        presenceSubscribers.put(channel, callback);
-        executorService.execute(() -> {
-            try {
-                Thread.sleep(1000);
-                callback.connectCallback(channel, "OK");
-            } catch (InterruptedException e) {
-            }
-        });
-    }
-
-    @Override
-    public void history(String channel, boolean reverse, Callback callback) {
-        executorService.execute(() -> {
-            try {
-                Thread.sleep(1000);
-                callback.successCallback(channel, new JSONArray("[[\"message1\", \"message2\", \"message3\"],\"Start Time Token\",\"End Time Token\"]"));
-            } catch (Exception e) {
-            }
-        });
-    }
-
-    @Override
-    public void setState(String channel, String uuid, JSONObject state, Callback callback) {
-        stateMap.put(uuid, state);
-        executorService.execute(() -> {
-            try {
-                Thread.sleep(1000);
-                callback.successCallback(channel, "OK");
-            } catch (Exception e) {
-            }
-        });
-    }
-
-    @Override
-    public void getState(String channel, String uuid, Callback callback) {
-        JSONObject jsonObject = stateMap.get(uuid);
-        executorService.execute(() -> {
-            try {
-                Thread.sleep(1000);
-                callback.successCallback(channel, jsonObject);
-            } catch (Exception e) {
-            }
-        });
-    }
-
-    @Override
-    public void hereNow(String channel, boolean state, boolean uuids, Callback callback) {
-
-        executorService.execute(() -> {
-            try {
-                Thread.sleep(500);
-                //@formatter:off
-                JSONObject response = new JSONObject("{\"uuids\":[\"76c2c571-9a2b-d074-b4f8-e93e09f49bd\"," 
-                                                    + "\"175c2c67-b2a9-470d-8f4b-1db94f90e39e\", "
-                                                    + "\"2c67175c-2a9b-074d-4b8f-90e39e1db94f\"]," 
-                                                    + "\"occupancy\":3 }");
-                //@formatter:on
-                callback.successCallback(channel, response);
-            } catch (Exception e) {
-            }
-
-        });
-    }
-
-    @Override
-    public void whereNow(String uuid, Callback callback) {
-        executorService.execute(() -> {
-            try {
-                Thread.sleep(1000);
-                callback.successCallback("channel", new JSONObject("{\"channels\":[\"hello_world\"]}"));
-            } catch (Exception e) {
-            }
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
index c918009..d0406db 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
@@ -16,75 +16,125 @@
  */
 package org.apache.camel.component.pubnub;
 
+
+
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import com.google.gson.JsonObject;
+import com.pubnub.api.models.consumer.history.PNHistoryItemResult;
+import com.pubnub.api.models.consumer.presence.PNHereNowResult;
+import com.pubnub.api.models.consumer.presence.PNSetStateResult;
+
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.json.JSONArray;
-import org.json.JSONObject;
 import org.junit.Test;
 
-public class PubNubOperationsTest extends CamelTestSupport {
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+public class PubNubOperationsTest extends PubNubTestBase {
 
     @Test
     public void testWhereNow() throws Exception {
+        stubFor(get(urlPathEqualTo("/v2/presence/sub-key/mySubscribeKey/uuid/myUUID"))
+            .willReturn(aResponse().withBody("{\"status\": 200, \"message\": \"OK\", \"payload\": {\"channels\": [\"channel-a\",\"channel-b\"]}, \"service\": \"Presence\"}")));
+
         Map<String, Object> headers = new HashMap<String, Object>();
         headers.put(PubNubConstants.OPERATION, "WHERE_NOW");
-        headers.put(PubNubConstants.UUID, "uuid");
-        JSONObject response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONObject.class);
+        headers.put(PubNubConstants.UUID, "myUUID");
+        @SuppressWarnings("unchecked")
+        List<String> response = template.requestBodyAndHeaders("direct:publish", null, headers, List.class);
         assertNotNull(response);
-        assertEquals("hello_world", response.getJSONArray("channels").getString(0));
+        assertListSize(response, 2);
+        assertEquals("channel-a", response.get(0));
     }
 
     @Test
     public void testHereNow() throws Exception {
+        stubFor(get(urlPathEqualTo("/v2/presence/sub_key/mySubscribeKey/channel/myChannel")).willReturn(aResponse()
+            .withBody("{\"status\" : 200, \"message\" : \"OK\", \"service\" : \"Presence\", \"uuids\" : [{\"uuid\" : \"myUUID0\"}, {\"state\" : {\"abcd\" : {\"age\" : 15}}, "
+                      + "\"uuid\" : \"myUUID1\"}, {\"uuid\" : \"b9eb408c-bcec-4d34-b4c4-fabec057ad0d\"}, {\"state\" : {\"abcd\" : {\"age\" : 15}}, \"uuid\" : \"myUUID2\"},"
+                      + " {\"state\" : {\"abcd\" : {\"age\" : 24}}, \"uuid\" : \"myUUID9\"}], \"occupancy\" : 5} Return Occupancy O")));
         Map<String, Object> headers = new HashMap<String, Object>();
         headers.put(PubNubConstants.OPERATION, "HERE_NOW");
-        JSONObject response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONObject.class);
+        PNHereNowResult response = template.requestBodyAndHeaders("direct:publish", null, headers, PNHereNowResult.class);
         assertNotNull(response);
-        assertEquals(3, response.getInt("occupancy"));
+        assertEquals(5, response.getTotalOccupancy());
     }
 
     @Test
     public void testGetHistory() throws Exception {
+        List<Object> testArray = new ArrayList<>();
+        List<Object> historyItems = new ArrayList<>();
+
+        Map<String, Object> historyEnvelope1 = new HashMap<>();
+        Map<String, Object> historyItem1 = new HashMap<>();
+        historyItem1.put("a", 11);
+        historyItem1.put("b", 22);
+        historyEnvelope1.put("timetoken", 1111);
+        historyEnvelope1.put("message", historyItem1);
+
+        Map<String, Object> historyEnvelope2 = new HashMap<>();
+        Map<String, Object> historyItem2 = new HashMap<>();
+        historyItem2.put("a", 33);
+        historyItem2.put("b", 44);
+        historyEnvelope2.put("timetoken", 2222);
+        historyEnvelope2.put("message", historyItem2);
+
+        historyItems.add(historyEnvelope1);
+        historyItems.add(historyEnvelope2);
+
+        testArray.add(historyItems);
+        testArray.add(1234);
+        testArray.add(4321);
+
+        stubFor(get(urlPathEqualTo("/v2/history/sub-key/mySubscribeKey/channel/myChannel")).willReturn(aResponse().withBody(getPubnub().getMapper().toJson(testArray))));
+
         Map<String, Object> headers = new HashMap<String, Object>();
         headers.put(PubNubConstants.OPERATION, "GET_HISTORY");
-        JSONArray response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONArray.class);
+        @SuppressWarnings("unchecked")
+        List<PNHistoryItemResult> response = template.requestBodyAndHeaders("direct:publish", null, headers, List.class);
         assertNotNull(response);
-        assertEquals("message1", response.getJSONArray(0).getString(0));
+        assertListSize(response, 2);
     }
 
     @Test
-    public void testSetAndGetState() throws Exception {
+    public void testGetState() throws Exception {
+        stubFor(get(urlPathEqualTo("/v2/presence/sub-key/mySubscribeKey/channel/myChannel/uuid/myuuid")).willReturn(aResponse()
+            .withBody("{ \"status\": 200, \"message\": \"OK\", \"payload\": "
+                      + "{ \"myChannel\": { \"age\" : 20, \"status\" : \"online\"}, \"ch2\": { \"age\": 100, \"status\": \"offline\" } }, \"service\": \"Presence\"}")));
         Map<String, Object> headers = new HashMap<String, Object>();
-        headers.put(PubNubConstants.OPERATION, "SET_STATE");
-        headers.put(PubNubConstants.UUID, "myuuid");
-        JSONObject state = new JSONObject("{\"state\":\"active\", \"lat\":\"55.645499\", \"lon\":\"12.370967\"}");
-        template.sendBodyAndHeaders("direct:publish", state, headers);
-        headers.replace(PubNubConstants.OPERATION, "GET_STATE");
-        JSONObject response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONObject.class);
+        headers.put(PubNubConstants.OPERATION, "GET_STATE");
+        @SuppressWarnings("unchecked")
+        Map<String, JsonObject> response = template.requestBodyAndHeaders("direct:publish", null, headers, Map.class);
         assertNotNull(response);
-        assertEquals(state, response);
+        assertNotNull(response.get("myChannel"));
     }
 
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
-        return registry;
+    @Test
+    public void testSetState() throws Exception {
+        stubFor(get(urlPathEqualTo("/v2/presence/sub-key/mySubscribeKey/channel/myChannel/uuid/myuuid/data"))
+                .willReturn(aResponse().withBody("{ \"status\": 200, \"message\": \"OK\", \"payload\": { \"age\" : 20, \"status\" : \"online\" }, \"service\": \"Presence\"}")));
+        Map<String, Object> myState = new HashMap<>();
+        myState.put("age", 20);
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put(PubNubConstants.OPERATION, "SET_STATE");
+        PNSetStateResult response = template.requestBodyAndHeaders("direct:publish", myState, headers, PNSetStateResult.class);
+        assertNotNull(response);
+        assertNotNull(response.getState());
+        assertEquals(20, response.getState().getAsJsonObject().get("age").getAsInt());
     }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                //@formatter:off
-                from("direct:publish").to("pubnub://pubsub:mychannel?uuid=myuuid&pubnub=#pubnub")
-                .to("log:io.rhiot.component.pubnub?showAll=true&multiline=true")
-                .to("mock:result");
-                //@formatter:on
+                from("direct:publish").to("pubnub:myChannel?uuid=myuuid&pubnub=#pubnub")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
index b794537..252a894 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
@@ -16,55 +16,53 @@
  */
 package org.apache.camel.component.pubnub;
 
-import com.pubnub.api.Callback;
+import com.pubnub.api.models.consumer.pubsub.PNPresenceEventResult;
 
 import org.apache.camel.EndpointInject;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.json.JSONObject;
 import org.junit.Test;
 
-public class PubNubPresensTest extends CamelTestSupport {
-    boolean connected;
-    private PubNubMock pubnubMock = new PubNubMock("foo", "bar");
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class PubNubPresensTest extends PubNubTestBase {
 
     @EndpointInject(uri = "mock:result")
     private MockEndpoint mockResult;
 
     @Test
     public void testPresens() throws Exception {
+        stubFor(get(urlPathEqualTo("/v2/presence/sub-key/mySubscribeKey/channel/mychannel/heartbeat"))
+            .willReturn(aResponse().withBody("{\"status\": 200, \"message\": \"OK\", \"service\": \"Presence\"}")));
+
+        stubFor(get(urlPathEqualTo("/v2/subscribe/mySubscribeKey/mychannel,mychannel-pnpres/0"))
+            .willReturn(aResponse()
+                .withBody("{\"t\":{\"t\":\"14637536741734954\",\"r\":1},\"m\":[{\"a\":\"4\",\"f\":512,\"p\":{\"t\":\"14637536740940378\",\"r\":1},\"k\":\"demo-36\",\"c\":\"mychannel-pnpres\","
+                          + "\"d\":{\"action\": \"join\", \"timestamp\": 1463753674, \"uuid\": \"24c9bb19-1fcd-4c40-a6f1-522a8a1329ef\", \"occupancy\": 3},\"b\":\"mychannel-pnpres\"},"
+                          + "{\"a\":\"4\",\"f\":512,\"p\":{\"t\":\"14637536741726901\",\"r\":1},\"k\":\"demo-36\",\"c\":\"mychannel-pnpres\",\"d\":{\"action\": \"state-change\", "
+                          + "\"timestamp\": 1463753674, \"data\": {\"state\": \"cool\"}, \"uuid\": \"24c9bb19-1fcd-4c40-a6f1-522a8a1329ef\", \"occupancy\": 3},\"b\":\"mychannel-pnpres\"}]}")));
+        context.startRoute("presence-route");
         mockResult.expectedMessageCount(1);
         mockResult.expectedHeaderReceived(PubNubConstants.CHANNEL, "mychannel");
-        pubnubMock.subscribe("mychannel", new Callback() {
-            @Override
-            public void connectCallback(String channel, Object message) {
-                connected = true;
-            }
-        });
         assertMockEndpointsSatisfied();
-        assertTrue(connected);
-        JSONObject presenceResponse = mockResult.getReceivedExchanges().get(0).getIn().getBody(JSONObject.class);
-        assertEquals("join", presenceResponse.getString("action"));
+        PNPresenceEventResult presence = mockResult.getReceivedExchanges().get(0).getIn().getBody(PNPresenceEventResult.class);
+        assertThat(presence.getEvent(), equalTo("join"));
     }
 
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
-        return registry;
-    }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                //@formatter:off
-                from("pubnub://presence:mychannel?pubnub=#pubnub")
-                    .to("log:org.apache.camel.component.pubnub?showAll=true&multiline=true")
+                from("pubnub:mychannel?pubnub=#pubnub&withPresence=true").id("presence-route")
+                    .autoStartup(false)
                     .to("mock:result");
-                //@formatter:on
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
new file mode 100644
index 0000000..8b3d9f0
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPublishTest.java
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+import static org.apache.camel.component.pubnub.PubNubConstants.TIMETOKEN;
+
+public class PubNubPublishTest extends PubNubTestBase {
+    private String endpoint = "pubnub:someChannel?pubnub=#pubnub";
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockResult;
+
+    @Test
+    public void testPubNub() throws Exception {
+        stubFor(post(urlPathEqualTo("/publish/myPublishKey/mySubscribeKey/0/someChannel/0")).willReturn(aResponse().withStatus(200).withBody("[1,\"Sent\",\"14598111595318003\"]")));
+        mockResult.expectedMessageCount(1);
+        mockResult.expectedHeaderReceived(TIMETOKEN, "14598111595318003");
+        template.sendBody("direct:publish", new Hello("Hi"));
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test(expected = CamelExecutionException.class)
+    public void testPubNubException() throws Exception {
+        stubFor(post(urlPathEqualTo("/publish/myPublishKey/mySubscribeKey/0/someChannel/0")).willReturn(aResponse().withStatus(401).withBody("[0,\"Blabla\",\"14598111595318003\"]")));
+
+        template.sendBody("direct:publish", new Hello("Hi"));
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test(expected = CamelExecutionException.class)
+    public void testPublishEmptyBody() throws Exception {
+        template.sendBody("direct:publish", null);
+    }
+
+    @Test
+    public void testFire() throws Exception {
+        stubFor(get(urlPathEqualTo("/publish/myPublishKey/mySubscribeKey/0/someChannel/0/%22Hi%22"))
+            .willReturn(aResponse().withBody("[1,\"Sent\",\"14598111595318003\"]")));
+        mockResult.expectedMessageCount(1);
+        mockResult.expectedHeaderReceived(TIMETOKEN, "14598111595318003");
+
+        template.sendBodyAndHeader("direct:publish", "Hi", PubNubConstants.OPERATION, "FIRE");
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:publish").to(endpoint).to("mock:result");
+            }
+        };
+    }
+
+    static class Hello {
+        private String message;
+
+        Hello(String message) {
+            this.message = message;
+        }
+
+        public String getMessage() {
+            return message;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
new file mode 100644
index 0000000..5202401
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubSubscriberTest.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+
+public class PubNubSubscriberTest extends PubNubTestBase {
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockResult;
+
+    @Test
+    public void testPubSubMessageSubscribe() throws Exception {
+        stubFor(get(urlPathEqualTo("/v2/subscribe/mySubscribeKey/mychannel/0"))
+            .willReturn(aResponse()
+                .withBody("{\"t\":{\"t\":\"14607577960932487\",\"r\":1},\"m\":[{\"a\":\"4\",\"f\":0,\"i\":\"Publisher-A\",\"p\":{\"t\":\"14607577960925503\",\"r\":1},\"o\":"
+                          + "{\"t\":\"14737141991877032\",\"r\":2},\"k\":\"sub-c-4cec9f8e-01fa-11e6-8180-0619f8945a4f\",\"c\":\"mychannel\",\"d\":{\"text\":\"Message\"},\"b\":\"coolChannel\"}]}")));
+        stubFor(get(urlPathEqualTo("/v2/presence/sub-key/mySubscribeKey/channel/mychannel/heartbeat"))
+            .willReturn(aResponse().withBody("{\"status\": 200, \"message\": \"OK\", \"service\": \"Presence\"}")));
+
+        context.startRoute("subroute");
+        mockResult.expectedMessageCount(1);
+        mockResult.expectedHeaderReceived(PubNubConstants.CHANNEL, "mychannel");
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from("pubnub:mychannel?pubnub=#pubnub").id("subroute").autoStartup(false)
+                    .to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubTestBase.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubTestBase.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubTestBase.java
new file mode 100644
index 0000000..647ca49
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubTestBase.java
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import java.io.IOException;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+import com.pubnub.api.PNConfiguration;
+import com.pubnub.api.PubNub;
+import com.pubnub.api.enums.PNLogVerbosity;
+
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+import static com.pubnub.api.enums.PNHeartbeatNotificationOptions.NONE;
+
+public class PubNubTestBase extends CamelTestSupport {
+    private final int port = AvailablePortFinder.getNextAvailable(3344);
+
+    private PubNub pubnub;
+
+    @Rule
+    public WireMockRule wireMockRule = new WireMockRule(options().port(port));
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        this.pubnub = createPubNubInstance();
+        registry.bind("pubnub", this.pubnub);
+        return registry;
+    }
+
+
+    @Before
+    public void beforeEach() throws IOException {
+        wireMockRule.start();
+    }
+
+    @After
+    public void afterEach() {
+        pubnub.destroy();
+    }
+
+    protected PubNub getPubnub() {
+        return pubnub;
+    }
+
+    private PubNub createPubNubInstance() {
+        PNConfiguration pnConfiguration = new PNConfiguration();
+
+        pnConfiguration.setOrigin("localhost" + ":" + port);
+        pnConfiguration.setSecure(false);
+        pnConfiguration.setSubscribeKey("mySubscribeKey");
+        pnConfiguration.setPublishKey("myPublishKey");
+        pnConfiguration.setUuid("myUUID");
+        pnConfiguration.setLogVerbosity(PNLogVerbosity.NONE);
+        pnConfiguration.setHeartbeatNotificationOptions(NONE);
+        class MockedTimePubNub extends PubNub {
+
+            MockedTimePubNub(PNConfiguration initialConfig) {
+                super(initialConfig);
+            }
+
+            @Override
+            public int getTimestamp() {
+                return 1337;
+            }
+
+            @Override
+            public String getVersion() {
+                return "suchJava";
+            }
+
+            @Override
+            public String getInstanceId() {
+                return "PubNubInstanceId";
+            }
+
+            @Override
+            public String getRequestId() {
+                return "PubNubRequestId";
+            }
+
+        }
+
+        return new MockedTimePubNub(pnConfiguration);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
index f24c917..4e7209d 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
@@ -19,6 +19,6 @@ package org.apache.camel.component.pubnub.example;
 public interface PubNubExampleConstants {
     // replace subscriber+publisher key with one obtained from PubNub.
     // http://www.pubnub.com
-    String PUBNUB_SUBSCRIBER_KEY = "mysubkey";
-    String PUBNUB_PUBLISHER_KEY = "mypubkey";
+    String PUBNUB_SUBSCRIBER_KEY = "subkey";
+    String PUBNUB_PUBLISHER_KEY = "pubkey";
 }


[11/11] camel git commit: CAMEL-11136: Add to kit and polished

Posted by da...@apache.org.
CAMEL-11136: Add to kit and polished


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5f47c859
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5f47c859
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5f47c859

Branch: refs/heads/master
Commit: 5f47c859d930f1b3220f04dd4077eb5cd8ca3962
Parents: b1f7ea6
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 21:16:37 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 apache-camel/pom.xml                            |   4 +
 .../src/main/descriptors/common-bin.xml         |   1 +
 camel-core/readme-eip.adoc                      |  21 +-
 camel-core/readme.adoc                          |  52 ++---
 components/camel-pubnub/pom.xml                 |  16 +-
 .../src/main/docs/pubnub-component.adoc         |  17 +-
 .../camel/component/pubnub/PubNubComponent.java |   5 +-
 .../component/pubnub/PubNubConfiguration.java   |   1 -
 .../camel/component/pubnub/PubNubConsumer.java  |  10 +-
 .../camel/component/pubnub/PubNubEndpoint.java  |   4 +-
 .../services/org/apache/camel/component/pubnub  |   1 +
 components/readme.adoc                          |  55 ++---
 docs/user-manual/en/SUMMARY.md                  |   1 +
 parent/pom.xml                                  |   5 +
 .../camel-pubnub-starter/pom.xml                |  51 +++++
 .../PubNubComponentAutoConfiguration.java       |  80 ++++++++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 +++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 ...dditional-spring-configuration-metadata.json |  10 +
 .../main/resources/META-INF/spring.factories    |  19 ++
 .../src/main/resources/META-INF/spring.provides |  18 ++
 21 files changed, 483 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 558cd9c..285ce04 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -738,6 +738,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-pubnub</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-quartz</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 9f297e2..c320469 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -192,6 +192,7 @@
         <include>org.apache.camel:camel-pgevent</include>
         <include>org.apache.camel:camel-printer</include>
         <include>org.apache.camel:camel-protobuf</include>
+        <include>org.apache.camel:camel-pubnub</include>
         <include>org.apache.camel:camel-quartz</include>
         <include>org.apache.camel:camel-quartz2</include>
         <include>org.apache.camel:camel-quickfix</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/camel-core/readme-eip.adoc
----------------------------------------------------------------------
diff --git a/camel-core/readme-eip.adoc b/camel-core/readme-eip.adoc
index 0fe8021..e652b4d 100644
--- a/camel-core/readme-eip.adoc
+++ b/camel-core/readme-eip.adoc
@@ -4,7 +4,7 @@ Enterprise Integration Patterns
 Camel supports most of the link:http://www.eaipatterns.com/toc.html[Enterprise Integration Patterns] from the excellent book by link:http://www.amazon.com/exec/obidos/search-handle-url/105-9796798-8100401?%5Fencoding=UTF8&search-type=ss&index=books&field-author=Gregor%20Hohpe[Gregor Hohpe] and link:http://www.amazon.com/exec/obidos/search-handle-url/105-9796798-8100401?%5Fencoding=UTF8&search-type=ss&index=books&field-author=Bobby%20Woolf[Bobby Woolf].
 
 // eips: START
-Number of EIPs: 62 (2 deprecated)
+Number of EIPs: 57 (0 deprecated)
 
 [width="100%",cols="4,6",options="header"]
 |=======================================================================
@@ -23,7 +23,7 @@ Number of EIPs: 62 (2 deprecated)
 `<choice>` | Routes messages based on a series of predicates
 
 | link:src/main/docs/eips/circuitBreaker-eip.adoc[Circuit Breaker] +
-`<circuitBreaker>` | *deprecated* Circuit break load balancer
+`<circuitBreaker>` | Circuit break load balancer
 
 | link:src/main/docs/eips/convertBodyTo-eip.adoc[Convert Body To] +
 `<convertBodyTo>` | Converts the message body to another type
@@ -49,12 +49,6 @@ Number of EIPs: 62 (2 deprecated)
 | link:src/main/docs/eips/from-eip.adoc[From] +
 `<from>` | Act as a message source as input to a route
 
-| link:src/main/docs/eips/hystrix-eip.adoc[Hystrix] +
-`<hystrix>` | Hystrix Circuit Breaker EIP
-
-| link:src/main/docs/eips/hystrixConfiguration-eip.adoc[Hystrix Configuration] +
-`<hystrixConfiguration>` | Hystrix Circuit Breaker EIP configuration
-
 | link:src/main/docs/eips/idempotentConsumer-eip.adoc[Idempotent Consumer] +
 `<idempotentConsumer>` | Filters out duplicate messages
 
@@ -67,9 +61,6 @@ Number of EIPs: 62 (2 deprecated)
 | link:src/main/docs/eips/loadBalance-eip.adoc[Load Balance] +
 `<loadBalance>` | Balances message processing among a number of nodes
 
-| link:src/main/docs/eips/log-eip.adoc[Log] +
-`<log>` | Logs the defined message to the logger
-
 | link:src/main/docs/eips/loop-eip.adoc[Loop] +
 `<loop>` | Processes a message multiple times
 
@@ -79,9 +70,6 @@ Number of EIPs: 62 (2 deprecated)
 | link:src/main/docs/eips/multicast-eip.adoc[Multicast] +
 `<multicast>` | Routes the same message to multiple paths either sequentially or in parallel.
 
-| link:src/main/docs/eips/onFallback-eip.adoc[On Fallback] +
-`<onFallback>` | Route to be executed when Hystrix EIP executes fallback
-
 | link:src/main/docs/eips/otherwise-eip.adoc[Otherwise] +
 `<otherwise>` | Route to be executed when all other choices evaluate to false
 
@@ -130,9 +118,6 @@ Number of EIPs: 62 (2 deprecated)
 | link:src/main/docs/eips/script-eip.adoc[Script] +
 `<script>` | Executes a script from a language which does not change the message body.
 
-| link:src/main/docs/eips/serviceCall-eip.adoc[Service Call] +
-`<serviceCall>` | Remote service call definition
-
 | link:src/main/docs/eips/setBody-eip.adoc[Set Body] +
 `<setBody>` | Sets the contents of the message body
 
@@ -143,7 +128,7 @@ Number of EIPs: 62 (2 deprecated)
 `<setHeader>` | Sets the value of a message header
 
 | link:src/main/docs/eips/setOutHeader-eip.adoc[Set Out Header] +
-`<setOutHeader>` | *deprecated* Sets the value of a header on the outbound message
+`<setOutHeader>` | Sets the value of a header on the outbound message
 
 | link:src/main/docs/eips/setProperty-eip.adoc[Set Property] +
 `<setProperty>` | Sets a named property on the message exchange

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/camel-core/readme.adoc
----------------------------------------------------------------------
diff --git a/camel-core/readme.adoc b/camel-core/readme.adoc
index f400b7f..03ab197 100644
--- a/camel-core/readme.adoc
+++ b/camel-core/readme.adoc
@@ -6,86 +6,86 @@ Components
 
 
 // components: START
-Number of Components: 25 in 1 JAR artifacts (1 deprecated)
+Number of Components: 25 in 1 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================
 | Component | Available From | Description
 
 | link:src/main/docs/bean-component.adoc[Bean] (camel-core) +
-`bean:beanName` | 1.0 | The bean component is for invoking Java beans from Camel.
+`bean:beanName` |  | The bean component is for invoking Java beans from Camel.
 
 | link:src/main/docs/binding-component.adoc[Binding] (camel-core) +
-`binding:bindingName:delegateUri` | 2.11 | *deprecated* The binding component is used for as a of wrapping an Endpoint in a contract with a data format.
+`binding:bindingName:delegateUri` |  | The binding component is used for as a of wrapping an Endpoint in a contract with a data format.
 
 | link:src/main/docs/browse-component.adoc[Browse] (camel-core) +
-`browse:name` | 1.3 | The browse component is used for viewing the messages received on endpoints that supports BrowsableEndpoint.
+`browse:name` |  | The browse component is used for viewsing the messages received on endpoints that supports BrowsableEndpoint.
 
 | link:src/main/docs/class-component.adoc[Class] (camel-core) +
-`class:beanName` | 2.4 | The Class Component is for invoking Java Classes (Java beans) from Camel.
+`class:beanName` |  | The Class Component is for invoking Java Classes (Java beans) from Camel.
 
 | link:src/main/docs/controlbus-component.adoc[Control Bus] (camel-core) +
-`controlbus:command:language` | 2.11 | The controlbus component provides easy management of Camel applications based on the Control Bus EIP pattern.
+`controlbus:command:language` |  | The controlbus component provides easy management of Camel applications based on the Control Bus EIP pattern.
 
 | link:src/main/docs/dataformat-component.adoc[Data Format] (camel-core) +
-`dataformat:name:operation` | 2.12 | The dataformat component is used for working with Data Formats as if it was a regular Component supporting Endpoints and URIs.
+`dataformat:name:operation` |  | The dataformat component is used for working with Data Formats as if it was a regular Component supporting Endpoints and URIs.
 
 | link:src/main/docs/dataset-component.adoc[Dataset] (camel-core) +
-`dataset:name` | 1.3 | The dataset component provides a mechanism to easily perform load & soak testing of your system.
+`dataset:name` |  | The dataset component provides a mechanism to easily perform load & soak testing of your system.
 
 | link:src/main/docs/direct-component.adoc[Direct] (camel-core) +
-`direct:name` | 1.0 | The direct component provides direct synchronous call to another endpoint from the same CamelContext.
+`direct:name` |  | The direct component provides direct synchronous call to another endpoint from the same CamelContext.
 
 | link:src/main/docs/direct-vm-component.adoc[Direct VM] (camel-core) +
-`direct-vm:name` | 2.10 | The direct-vm component provides direct synchronous call to another endpoint from any CamelContext in the same JVM.
+`direct-vm:name` |  | The direct-vm component provides direct synchronous call to another endpoint from any CamelContext in the same JVM.
 
 | link:src/main/docs/file-component.adoc[File] (camel-core) +
-`file:directoryName` | 1.0 | The file component is used for reading or writing files.
+`file:directoryName` |  | The file component is used for reading or writing files.
 
 | link:src/main/docs/language-component.adoc[Language] (camel-core) +
-`language:languageName:resourceUri` | 2.5 | The language component allows you to send a message to an endpoint which executes a script by any of the supported Languages in Camel.
+`language:languageName:resourceUri` |  | The language component allows you to send a message to an endpoint which executes a script by any of the supported Languages in Camel.
 
 | link:src/main/docs/log-component.adoc[Log] (camel-core) +
-`log:loggerName` | 1.1 | The log component logs message exchanges to the underlying logging mechanism.
+`log:loggerName` |  | The log component logs message exchanges to the underlying logging mechanism.
 
 | link:src/main/docs/mock-component.adoc[Mock] (camel-core) +
-`mock:name` | 1.0 | The mock component is used for testing routes and mediation rules using mocks.
+`mock:name` |  | The mock component is used for testing routes and mediation rules using mocks.
 
 | link:src/main/docs/properties-component.adoc[Properties] (camel-core) +
-`properties:key` | 2.3 | The properties component is used for using property placeholders in endpoint uris.
+`properties:key` |  | The properties component is used for using property placeholders in endpoint uris.
 
 | link:src/main/docs/ref-component.adoc[Ref] (camel-core) +
-`ref:name` | 1.2 | The ref component is used for lookup of existing endpoints bound in the Registry.
+`ref:name` |  | The ref component is used for lookup of existing endpoints bound in the Registry.
 
 | link:src/main/docs/rest-component.adoc[REST] (camel-core) +
-`rest:method:path:uriTemplate` | 2.14 | The rest component is used for either hosting REST services (consumer) or calling external REST services (producer).
+`rest:method:path:uriTemplate` |  | The rest component is used for hosting REST services which has been defined using the rest-dsl in Camel.
 
 | link:src/main/docs/rest-api-component.adoc[REST API] (camel-core) +
-`rest-api:path/contextIdPattern` | 2.16 | The rest-api component is used for providing Swagger API of the REST services which has been defined using the rest-dsl in Camel.
+`rest-api:path/contextIdPattern` |  | The rest-api component is used for providing Swagger API of the REST services which has been defined using the rest-dsl in Camel.
 
 | link:src/main/docs/scheduler-component.adoc[Scheduler] (camel-core) +
-`scheduler:name` | 2.15 | The scheduler component is used for generating message exchanges when a scheduler fires.
+`scheduler:name` |  | The scheduler component is used for generating message exchanges when a scheduler fires.
 
 | link:src/main/docs/seda-component.adoc[SEDA] (camel-core) +
-`seda:name` | 1.1 | The seda component provides asynchronous call to another endpoint from any CamelContext in the same JVM.
+`seda:name` |  | The seda component provides asynchronous call to another endpoint from any CamelContext in the same JVM.
 
 | link:src/main/docs/stub-component.adoc[Stub] (camel-core) +
-`stub:name` | 2.10 | The stub component provides a simple way to stub out any physical endpoints while in development or testing.
+`stub:name` |  | The stub component provides a simple way to stub out any physical endpoints while in development or testing.
 
 | link:src/main/docs/test-component.adoc[Test] (camel-core) +
-`test:name` | 1.3 | The test component extends the mock component by on startup to pull messages from another endpoint to set the expected message bodies.
+`test:name` |  | The test component extends the mock component by on startup to pull messages from another endpoint to set the expected message bodies.
 
 | link:src/main/docs/timer-component.adoc[Timer] (camel-core) +
-`timer:timerName` | 1.0 | The timer component is used for generating message exchanges when a timer fires.
+`timer:timerName` |  | The timer component is used for generating message exchanges when a timer fires.
 
 | link:src/main/docs/validator-component.adoc[Validator] (camel-core) +
-`validator:resourceUri` | 1.1 | Validates the payload of a message using XML Schema and JAXP Validation.
+`validator:resourceUri` |  | Validates the payload of a message using XML Schema and JAXP Validation.
 
 | link:src/main/docs/vm-component.adoc[VM] (camel-core) +
-`vm:name` | 1.1 | The vm component provides asynchronous call to another endpoint from the same CamelContext.
+`vm:name` |  | The vm component provides asynchronous call to another endpoint from the same CamelContext.
 
 | link:src/main/docs/xslt-component.adoc[XSLT] (camel-core) +
-`xslt:resourceUri` | 1.3 | Transforms the message using a XSLT template.
+`xslt:resourceUri` |  | Transforms the message using a XSLT template.
 
 |=======================================================================
 // components: END

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/camel-pubnub/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/pom.xml b/components/camel-pubnub/pom.xml
index 2999a2b..9d25f1e 100644
--- a/components/camel-pubnub/pom.xml
+++ b/components/camel-pubnub/pom.xml
@@ -17,7 +17,9 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
   <modelVersion>4.0.0</modelVersion>
+
   <parent>
     <groupId>org.apache.camel</groupId>
     <artifactId>components</artifactId>
@@ -26,9 +28,8 @@
 
   <artifactId>camel-pubnub</artifactId>
   <packaging>jar</packaging>
-
   <name>Camel :: PubNub</name>
-  <description>Camel PubNub component</description>
+  <description>Camel PubNub Support</description>
 
   <properties>
     <camel.osgi.export.pkg>org.apache.camel.component.pubnub.*</camel.osgi.export.pkg>
@@ -76,20 +77,11 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>com.github.tomakehurst</groupId>
       <artifactId>wiremock</artifactId>
       <version>${wiremock-version}</version>
       <scope>test</scope>
     </dependency>
+
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/camel-pubnub/src/main/docs/pubnub-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/docs/pubnub-component.adoc b/components/camel-pubnub/src/main/docs/pubnub-component.adoc
index 9124563..9523d05 100644
--- a/components/camel-pubnub/src/main/docs/pubnub-component.adoc
+++ b/components/camel-pubnub/src/main/docs/pubnub-component.adoc
@@ -1,10 +1,11 @@
 ## PubNub Component
 
-*Available as of Camel version *
+*Available as of Camel version 2.19*
 
-Camel PubNub component can be used to communicate with the https://www.pubnub.com/[PubNub] data stream network for connected devices. This component uses pubnub https://github.com/pubnub/java[java library].
+Camel PubNub component can be used to communicate with the https://www.pubnub.com/[PubNub] data stream network for connected devices.
+This component uses pubnub https://github.com/pubnub/java[java library].
 
-### Use cases include
+Use cases includs:
 
 ** Chat rooms: Sending and receiving messages
 ** Locations and Connected cars: dispatching taxi cabs
@@ -89,17 +90,19 @@ with the following path and query parameters:
 |=======================================================================
 |Name |Description
 |`CamelPubNubTimeToken` |The Timestamp for the event.
-
 |`CamelPubNubChannel` |The channel for which the message belongs.
+|=======================================================================
+
+
+### Message body
 
-### Messsage body
 The message body can contain any JSON serializable data, including: Objects, Arrays, Ints and Strings. Message data should not contain special Java V4 classes or functions as these will not serialize. String content can include any single-byte or multi-byte UTF-8
 
 Object serialization when sending is done automatically. Just pass the full object as the message payload. PubNub will takes care of object serialization.
 
 When receiving the message body utilize objects provided by the PubNub API.
 
-### Use cases
+### Examples
 
 #### Publishing events
 
@@ -140,4 +143,4 @@ The example illustrates the PubNub component subscribing to a infinite stream of
 * link:endpoint.html[Endpoint]
 * link:getting-started.html[Getting Started]
 
-* link:rss.html[RSS]
+* link:rss.html[RSS]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
index b35e05d..c27e6e0 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
@@ -23,9 +23,6 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
 
-/**
- * Represents the component that manages {@link PubNubEndpoint}.
- */
 public class PubNubComponent extends DefaultComponent {
 
     public PubNubComponent(CamelContext context) {
@@ -39,9 +36,11 @@ public class PubNubComponent extends DefaultComponent {
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
         ObjectHelper.notNull(remaining, "channel");
+
         PubNubConfiguration pubNubConfiguration = new PubNubConfiguration();
         pubNubConfiguration.setChannel(remaining);
         setProperties(pubNubConfiguration, parameters);
+
         PubNubEndpoint endpoint = new PubNubEndpoint(uri, this, pubNubConfiguration);
         setProperties(endpoint, parameters);
         return endpoint;

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
index d8546b7..88ae43c 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.pubnub;
 
-
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
index 3fecaca..86d09b9 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.pubnub;
 
-
 import java.util.Arrays;
 
 import com.pubnub.api.PubNub;
@@ -29,7 +28,6 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultConsumer;
-import org.apache.camel.impl.DefaultExchange;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -96,10 +94,10 @@ public class PubNubConsumer extends DefaultConsumer {
         @Override
         public void status(PubNub pubnub, PNStatus status) {
             if (status.getCategory() == PNUnexpectedDisconnectCategory || status.getCategory() == PNTimeoutCategory) {
-                LOG.trace("Got status : {}. Reconnecting to PubNub", status);
+                LOG.trace("Got status: {}. Reconnecting to PubNub", status);
                 pubnub.reconnect();
             } else {
-                LOG.trace("Status message : {}", status);
+                LOG.trace("Status message: {}", status);
             }
         }
 
@@ -113,14 +111,13 @@ public class PubNubConsumer extends DefaultConsumer {
             try {
                 getProcessor().process(exchange);
             } catch (Exception e) {
-                exchange.setException(e);
                 getExceptionHandler().handleException("Error processing exchange", exchange, e);
             }
         }
 
         @Override
         public void presence(PubNub pubnub, PNPresenceEventResult presence) {
-            Exchange exchange = new DefaultExchange(endpoint, endpoint.getExchangePattern());
+            Exchange exchange = endpoint.createExchange();
             Message inmessage = exchange.getIn();
             inmessage.setBody(presence);
             inmessage.setHeader(TIMETOKEN, presence.getTimetoken());
@@ -131,7 +128,6 @@ public class PubNubConsumer extends DefaultConsumer {
                 exchange.setException(e);
                 getExceptionHandler().handleException("Error processing exchange", exchange, e);
             }
-
         }
 
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
index f7d2c3f..70e5f5b 100644
--- a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.pubnub;
 
-
 import com.pubnub.api.PNConfiguration;
 import com.pubnub.api.PubNub;
 
@@ -28,7 +27,8 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
 
-@UriEndpoint(scheme = "pubnub", title = "PubNub", syntax = "pubnub:channel", consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
+@UriEndpoint(firstVersion = "2.19.0", scheme = "pubnub", title = "PubNub", syntax = "pubnub:channel",
+    consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
 public class PubNubEndpoint extends DefaultEndpoint {
 
     @UriParam(label = "advanced")

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub b/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub
index 1e8433c..c929111 100644
--- a/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub
+++ b/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub
@@ -14,4 +14,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
 class=org.apache.camel.component.pubnub.PubNubComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/components/readme.adoc
----------------------------------------------------------------------
diff --git a/components/readme.adoc b/components/readme.adoc
index 0dfca91..7b5a6dc 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -2,7 +2,7 @@ Components
 ^^^^^^^^^^
 
 // components: START
-Number of Components: 230 in 183 JAR artifacts (14 deprecated)
+Number of Components: 231 in 184 JAR artifacts (13 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================
@@ -84,7 +84,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `azure-queue:containerAndQueueUri` | 2.19 | The azure-queue component is used for storing and retrieving messages from Azure Storage Queue Service.
 
 | link:../camel-core/src/main/docs/bean-component.adoc[Bean] (camel-core) +
-`bean:beanName` | 1.0 | The bean component is for invoking Java beans from Camel.
+`bean:beanName` |  | The bean component is for invoking Java beans from Camel.
 
 | link:camel-bean-validator/src/main/docs/bean-validator-component.adoc[Bean Validator] (camel-bean-validator) +
 `bean-validator:label` | 2.3 | The Validator component performs bean validation of the message body using the Java Bean Validation API.
@@ -93,7 +93,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `beanstalk:connectionSettings` | 2.15 | The beanstalk component is used for job retrieval and post-processing of Beanstalk jobs.
 
 | link:../camel-core/src/main/docs/binding-component.adoc[Binding] (camel-core) +
-`binding:bindingName:delegateUri` | 2.11 | *deprecated* The binding component is used for as a of wrapping an Endpoint in a contract with a data format.
+`binding:bindingName:delegateUri` |  | The binding component is used for as a of wrapping an Endpoint in a contract with a data format.
 
 | link:camel-bonita/src/main/docs/bonita-component.adoc[Bonita] (camel-bonita) +
 `bonita:operation` | 2.19 | Camel Bonita support
@@ -105,7 +105,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `braintree:apiName/methodName` | 2.17 | The braintree component is used for integrating with the Braintree Payment System.
 
 | link:../camel-core/src/main/docs/browse-component.adoc[Browse] (camel-core) +
-`browse:name` | 1.3 | The browse component is used for viewing the messages received on endpoints that supports BrowsableEndpoint.
+`browse:name` |  | The browse component is used for viewsing the messages received on endpoints that supports BrowsableEndpoint.
 
 | link:camel-context/src/main/docs/context-component.adoc[Camel Context] (camel-context) +
 `context:contextId:localEndpointUrl` | 2.7 | *deprecated* The context component allows to send/receive messages between Camel routes in a black box way.
@@ -120,7 +120,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `chunk:resourceUri` | 2.15 | Transforms the message using a Chunk template.
 
 | link:../camel-core/src/main/docs/class-component.adoc[Class] (camel-core) +
-`class:beanName` | 2.4 | The Class Component is for invoking Java Classes (Java beans) from Camel.
+`class:beanName` |  | The Class Component is for invoking Java Classes (Java beans) from Camel.
 
 | link:camel-cm-sms/src/main/docs/cm-sms-component.adoc[CM SMS Gateway] (camel-cm-sms) +
 `cm-sms:host` | 2.18 | The influxdb component allows to integrate with CM SMS Gateway.
@@ -138,7 +138,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `consul:apiEndpoint` | 2.18 | The camel consul component allows you to work with Consul a distributed highly available datacenter-aware service discovery and configuration system.
 
 | link:../camel-core/src/main/docs/controlbus-component.adoc[Control Bus] (camel-core) +
-`controlbus:command:language` | 2.11 | The controlbus component provides easy management of Camel applications based on the Control Bus EIP pattern.
+`controlbus:command:language` |  | The controlbus component provides easy management of Camel applications based on the Control Bus EIP pattern.
 
 | link:camel-couchbase/src/main/docs/couchbase-component.adoc[Couchbase] (camel-couchbase) +
 `couchbase:url` | 2.19 | Represents a Couchbase endpoint that can query Views with a Poll strategy and/or produce various type of operations.
@@ -156,19 +156,19 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `cxfrs:beanId:address` | 2.0 | The cxfrs component is used for JAX-RS REST services using Apache CXF.
 
 | link:../camel-core/src/main/docs/dataformat-component.adoc[Data Format] (camel-core) +
-`dataformat:name:operation` | 2.12 | The dataformat component is used for working with Data Formats as if it was a regular Component supporting Endpoints and URIs.
+`dataformat:name:operation` |  | The dataformat component is used for working with Data Formats as if it was a regular Component supporting Endpoints and URIs.
 
 | link:../camel-core/src/main/docs/dataset-component.adoc[Dataset] (camel-core) +
-`dataset:name` | 1.3 | The dataset component provides a mechanism to easily perform load & soak testing of your system.
+`dataset:name` |  | The dataset component provides a mechanism to easily perform load & soak testing of your system.
 
 | link:camel-digitalocean/src/main/docs/digitalocean-component.adoc[DigitalOcean] (camel-digitalocean) +
 `digitalocean:operation` | 2.19 | The DigitalOcean component allows you to manage Droplets and resources within the DigitalOcean cloud.
 
 | link:../camel-core/src/main/docs/direct-component.adoc[Direct] (camel-core) +
-`direct:name` | 1.0 | The direct component provides direct synchronous call to another endpoint from the same CamelContext.
+`direct:name` |  | The direct component provides direct synchronous call to another endpoint from the same CamelContext.
 
 | link:../camel-core/src/main/docs/direct-vm-component.adoc[Direct VM] (camel-core) +
-`direct-vm:name` | 2.10 | The direct-vm component provides direct synchronous call to another endpoint from any CamelContext in the same JVM.
+`direct-vm:name` |  | The direct-vm component provides direct synchronous call to another endpoint from any CamelContext in the same JVM.
 
 | link:camel-disruptor/src/main/docs/disruptor-component.adoc[Disruptor] (camel-disruptor) +
 `disruptor:name` | 2.12 | The disruptor component provides asynchronous SEDA behavior using LMAX Disruptor.
@@ -216,7 +216,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `facebook:methodName` | 2.14 | The Facebook component provides access to all of the Facebook APIs accessible using Facebook4J.
 
 | link:../camel-core/src/main/docs/file-component.adoc[File] (camel-core) +
-`file:directoryName` | 1.0 | The file component is used for reading or writing files.
+`file:directoryName` |  | The file component is used for reading or writing files.
 
 | link:camel-flatpack/src/main/docs/flatpack-component.adoc[Flatpack] (camel-flatpack) +
 `flatpack:type:resourceUri` | 1.4 | The flatpack component supports fixed width and delimited file parsing via the FlatPack library.
@@ -369,7 +369,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `kubernetes:masterUrl` | 2.17 | The kubernetes component allows to work with Kubernetes PaaS.
 
 | link:../camel-core/src/main/docs/language-component.adoc[Language] (camel-core) +
-`language:languageName:resourceUri` | 2.5 | The language component allows you to send a message to an endpoint which executes a script by any of the supported Languages in Camel.
+`language:languageName:resourceUri` |  | The language component allows you to send a message to an endpoint which executes a script by any of the supported Languages in Camel.
 
 | link:camel-ldap/src/main/docs/ldap-component.adoc[LDAP] (camel-ldap) +
 `ldap:dirContextName` | 1.5 | The ldap component allows you to perform searches in LDAP servers using filters as the message payload.
@@ -378,7 +378,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `linkedin:apiName/methodName` | 2.14 | The linkedin component is uses for retrieving LinkedIn user profiles connections companies groups posts etc.
 
 | link:../camel-core/src/main/docs/log-component.adoc[Log] (camel-core) +
-`log:loggerName` | 1.1 | The log component logs message exchanges to the underlying logging mechanism.
+`log:loggerName` |  | The log component logs message exchanges to the underlying logging mechanism.
 
 | link:camel-lucene/src/main/docs/lucene-component.adoc[Lucene] (camel-lucene) +
 `lucene:host:operation` | 2.2 | To insert or query from Apache Lucene databases.
@@ -402,7 +402,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `mllp:hostname:port` | 2.17 | Provides functionality required by Healthcare providers to communicate with other systems using the MLLP protocol.
 
 | link:../camel-core/src/main/docs/mock-component.adoc[Mock] (camel-core) +
-`mock:name` | 1.0 | The mock component is used for testing routes and mediation rules using mocks.
+`mock:name` |  | The mock component is used for testing routes and mediation rules using mocks.
 
 | link:camel-mongodb/src/main/docs/mongodb-component.adoc[MongoDB] (camel-mongodb) +
 `mongodb:connectionBean` | 2.10 | Component for working with documents stored in MongoDB database.
@@ -498,7 +498,10 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `lpr:hostname:port/printername` | 2.1 | The printer component is used for sending messages to printers as print jobs.
 
 | link:../camel-core/src/main/docs/properties-component.adoc[Properties] (camel-core) +
-`properties:key` | 2.3 | The properties component is used for using property placeholders in endpoint uris.
+`properties:key` |  | The properties component is used for using property placeholders in endpoint uris.
+
+| link:camel-pubnub/src/main/docs/pubnub-component.adoc[PubNub] (camel-pubnub) +
+`pubnub:channel` | 2.19 | Camel PubNub Support
 
 | link:camel-quartz/src/main/docs/quartz-component.adoc[Quartz] (camel-quartz) +
 `quartz:groupName/timerName` | 1.0 | *deprecated* Provides a scheduled delivery of messages using the Quartz 1.x scheduler.
@@ -516,13 +519,13 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `reactive-streams:stream` | 2.19 | Reactive Camel using reactive streams
 
 | link:../camel-core/src/main/docs/ref-component.adoc[Ref] (camel-core) +
-`ref:name` | 1.2 | The ref component is used for lookup of existing endpoints bound in the Registry.
+`ref:name` |  | The ref component is used for lookup of existing endpoints bound in the Registry.
 
 | link:../camel-core/src/main/docs/rest-component.adoc[REST] (camel-core) +
-`rest:method:path:uriTemplate` | 2.14 | The rest component is used for either hosting REST services (consumer) or calling external REST services (producer).
+`rest:method:path:uriTemplate` |  | The rest component is used for hosting REST services which has been defined using the rest-dsl in Camel.
 
 | link:../camel-core/src/main/docs/rest-api-component.adoc[REST API] (camel-core) +
-`rest-api:path/contextIdPattern` | 2.16 | The rest-api component is used for providing Swagger API of the REST services which has been defined using the rest-dsl in Camel.
+`rest-api:path/contextIdPattern` |  | The rest-api component is used for providing Swagger API of the REST services which has been defined using the rest-dsl in Camel.
 
 | link:camel-rest-swagger/src/main/docs/rest-swagger-component.adoc[REST Swagger] (camel-rest-swagger) +
 `rest-swagger:specificationUri#operationId` | 2.19 | An awesome REST endpoint backed by Swagger specifications.
@@ -546,7 +549,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `sap-netweaver:url` | 2.12 | The sap-netweaver component integrates with the SAP NetWeaver Gateway using HTTP transports.
 
 | link:../camel-core/src/main/docs/scheduler-component.adoc[Scheduler] (camel-core) +
-`scheduler:name` | 2.15 | The scheduler component is used for generating message exchanges when a scheduler fires.
+`scheduler:name` |  | The scheduler component is used for generating message exchanges when a scheduler fires.
 
 | link:camel-schematron/src/main/docs/schematron-component.adoc[Schematron] (camel-schematron) +
 `schematron:path` | 2.15 | Validates the payload of a message using the Schematron Library.
@@ -555,7 +558,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `scp:host:port/directoryName` | 2.10 | To copy files using the secure copy protocol (SCP).
 
 | link:../camel-core/src/main/docs/seda-component.adoc[SEDA] (camel-core) +
-`seda:name` | 1.1 | The seda component provides asynchronous call to another endpoint from any CamelContext in the same JVM.
+`seda:name` |  | The seda component provides asynchronous call to another endpoint from any CamelContext in the same JVM.
 
 | link:camel-servicenow/src/main/docs/servicenow-component.adoc[ServiceNow] (camel-servicenow) +
 `servicenow:instanceName` | 2.18 | The servicenow component is used to integrate Camel with ServiceNow cloud services.
@@ -636,19 +639,19 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `string-template:resourceUri` | 1.2 | Transforms the message using a String template.
 
 | link:../camel-core/src/main/docs/stub-component.adoc[Stub] (camel-core) +
-`stub:name` | 2.10 | The stub component provides a simple way to stub out any physical endpoints while in development or testing.
+`stub:name` |  | The stub component provides a simple way to stub out any physical endpoints while in development or testing.
 
 | link:camel-telegram/src/main/docs/telegram-component.adoc[Telegram] (camel-telegram) +
 `telegram:type/authorizationToken` | 2.18 | The telegram component provides access to the Telegram Bot API.
 
 | link:../camel-core/src/main/docs/test-component.adoc[Test] (camel-core) +
-`test:name` | 1.3 | The test component extends the mock component by on startup to pull messages from another endpoint to set the expected message bodies.
+`test:name` |  | The test component extends the mock component by on startup to pull messages from another endpoint to set the expected message bodies.
 
 | link:camel-tika/src/main/docs/tika-component.adoc[Tika] (camel-tika) +
 `tika:operation` | 2.19 | This component integrates with Apache Tika to extract content and metadata from thousands of file types.
 
 | link:../camel-core/src/main/docs/timer-component.adoc[Timer] (camel-core) +
-`timer:timerName` | 1.0 | The timer component is used for generating message exchanges when a timer fires.
+`timer:timerName` |  | The timer component is used for generating message exchanges when a timer fires.
 
 | link:camel-twitter/src/main/docs/twitter-component.adoc[Twitter] (camel-twitter) +
 `twitter:kind` | 2.10 | This component integrates with Twitter to send tweets or search for tweets and more.
@@ -657,7 +660,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `undertow:httpURI` | 2.16 | The undertow component provides HTTP-based endpoints for consuming and producing HTTP requests.
 
 | link:../camel-core/src/main/docs/validator-component.adoc[Validator] (camel-core) +
-`validator:resourceUri` | 1.1 | Validates the payload of a message using XML Schema and JAXP Validation.
+`validator:resourceUri` |  | Validates the payload of a message using XML Schema and JAXP Validation.
 
 | link:camel-velocity/src/main/docs/velocity-component.adoc[Velocity] (camel-velocity) +
 `velocity:resourceUri` | 1.2 | Transforms the message using a Velocity template.
@@ -666,7 +669,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `vertx:address` | 2.12 | The vertx component is used for sending and receive messages from a vertx event bus.
 
 | link:../camel-core/src/main/docs/vm-component.adoc[VM] (camel-core) +
-`vm:name` | 1.1 | The vm component provides asynchronous call to another endpoint from the same CamelContext.
+`vm:name` |  | The vm component provides asynchronous call to another endpoint from the same CamelContext.
 
 | link:camel-weather/src/main/docs/weather-component.adoc[Weather] (camel-weather) +
 `weather:name` | 2.12 | Polls the weather information from Open Weather Map.
@@ -684,7 +687,7 @@ Number of Components: 230 in 183 JAR artifacts (14 deprecated)
 `xquery:resourceUri` | 1.0 | Transforms the message using a XQuery template using Saxon.
 
 | link:../camel-core/src/main/docs/xslt-component.adoc[XSLT] (camel-core) +
-`xslt:resourceUri` | 1.3 | Transforms the message using a XSLT template.
+`xslt:resourceUri` |  | Transforms the message using a XSLT template.
 
 | link:camel-yammer/src/main/docs/yammer-component.adoc[Yammer] (camel-yammer) +
 `yammer:function` | 2.12 | The yammer component allows you to interact with the Yammer enterprise social network.

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index bdd6a79..97a0bdb 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -274,6 +274,7 @@
 	* [PDF](pdf-component.adoc)
 	* [PostgresSQL Event](pgevent-component.adoc)
 	* [Printer](lpr-component.adoc)
+	* [PubNub](pubnub-component.adoc)
 	* [Quartz](quartz-component.adoc)
 	* [Quartz2](quartz2-component.adoc)
 	* [QuickFix](quickfix-component.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b84caad..3d0d888 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1644,6 +1644,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pubnub</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-quartz</artifactId>
         <version>${project.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/platforms/spring-boot/components-starter/camel-pubnub-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/pom.xml b/platforms/spring-boot/components-starter/camel-pubnub-starter/pom.xml
new file mode 100644
index 0000000..573e8ab
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components-starter</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>camel-pubnub-starter</artifactId>
+  <packaging>jar</packaging>
+  <name>Spring-Boot Starter :: Camel :: PubNub</name>
+  <description>Spring-Boot Starter for Camel PubNub component</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-pubnub</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <!--START OF GENERATED CODE-->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <!--END OF GENERATED CODE-->
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java
new file mode 100644
index 0000000..897f9d4
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub.springboot;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.pubnub.PubNubComponent;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionMessage;
+import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
+import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.core.type.AnnotatedTypeMetadata;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Configuration
+@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@Conditional(PubNubComponentAutoConfiguration.Condition.class)
+@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+public class PubNubComponentAutoConfiguration {
+
+    @Lazy
+    @Bean(name = "pubnub-component")
+    @ConditionalOnClass(CamelContext.class)
+    @ConditionalOnMissingBean(PubNubComponent.class)
+    public PubNubComponent configurePubNubComponent(CamelContext camelContext)
+            throws Exception {
+        PubNubComponent component = new PubNubComponent();
+        component.setCamelContext(camelContext);
+        return component;
+    }
+
+    public static class Condition extends SpringBootCondition {
+        @Override
+        public ConditionOutcome getMatchOutcome(
+                ConditionContext conditionContext,
+                AnnotatedTypeMetadata annotatedTypeMetadata) {
+            boolean groupEnabled = isEnabled(conditionContext,
+                    "camel.component.", true);
+            ConditionMessage.Builder message = ConditionMessage
+                    .forCondition("camel.component.pubnub");
+            if (isEnabled(conditionContext, "camel.component.pubnub.",
+                    groupEnabled)) {
+                return ConditionOutcome.match(message.because("enabled"));
+            }
+            return ConditionOutcome.noMatch(message.because("not enabled"));
+        }
+
+        private boolean isEnabled(
+                org.springframework.context.annotation.ConditionContext context,
+                java.lang.String prefix, boolean defaultValue) {
+            RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
+                    context.getEnvironment(), prefix);
+            return resolver.getProperty("enabled", Boolean.class, defaultValue);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000..e6908ba
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+  "properties": [
+    {
+      "defaultValue": true,
+      "name": "camel.component.pubnub.enabled",
+      "description": "Enable pubnub component",
+      "type": "java.lang.Boolean"
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..c53ee3b
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.camel.component.pubnub.springboot.PubNubComponentAutoConfiguration

http://git-wip-us.apache.org/repos/asf/camel/blob/5f47c859/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.provides
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..0a64a91
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+provides: camel-pubnub
\ No newline at end of file


[04/11] camel git commit: initial commit of camel-pubnub component

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
new file mode 100644
index 0000000..01d51fa
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub.example;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.pubnub.PubNubConstants;
+import org.apache.camel.main.Main;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public final class PubNubSensor2Example {
+
+    private PubNubSensor2Example() {
+    }
+
+    public static void main(String[] args) throws Exception {
+        Main main = new Main();
+        main.addRouteBuilder(new PubsubRoute());
+        main.addRouteBuilder(new SimulatedDeviceEventGeneratorRoute());
+        main.run();
+    }
+
+    static class SimulatedDeviceEventGeneratorRoute extends RouteBuilder {
+        private final String deviceEP = "pubnub://pubsub:iot?uuid=device2&publisherKey=" + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY + "&subscriberKey="
+                                        + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
+        private final String devicePrivateEP = "pubnub://pubsub:device2private?uuid=device2&publisherKey=" + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY + "&subscriberKey="
+                                               + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
+
+        @Override
+        public void configure() throws Exception {
+            //@formatter:off
+            from("timer:device2").routeId("device-event-route")
+                .bean(PubNubSensor2Example.EventGeneratorBean.class, "getRandomEvent('device2')")
+                .convertBodyTo(JSONObject.class)
+                .to(deviceEP);
+            
+            from(devicePrivateEP)
+                .routeId("device-unicast-route")
+                .log("Message from master to device2 : ${body}");
+            //@formatter:on
+        }
+    }
+
+    static class PubsubRoute extends RouteBuilder {
+        private static String masterEP = "pubnub://pubsub:iot?uuid=master&subscriberKey=" + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY + "&publisherKey="
+                                         + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY;
+        private static Map<String, String> devices = new ConcurrentHashMap<String, String>();
+
+        @Override
+        public void configure() throws Exception {
+            //@formatter:off
+            from(masterEP)
+                .routeId("master-route")
+                .convertBodyTo(JSONObject.class)
+                .bean(PubNubSensor2Example.PubsubRoute.DataProcessorBean.class, "doSomethingInteresting(${body})")
+                .log("${body} headers : ${headers}").to("mock:result");
+            
+            //TODO Could remote control device to turn on/off sensor measurement 
+            from("timer:master?delay=15s&period=5s").routeId("unicast2device-route")
+                .setHeader(PubNubConstants.CHANNEL, method(PubNubSensor2Example.PubsubRoute.DataProcessorBean.class, "getUnicastChannelOfDevice()"))
+                .setBody(constant("Hello device"))
+                .to(masterEP);
+            //@formatter:on
+        }
+
+        static class DataProcessorBean {
+            @EndpointInject(uri = "pubnub://pubsub:iot?uuid=master&subscriberKey=" + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY)
+            private static ProducerTemplate template;
+
+            public static String getUnicastChannelOfDevice() {
+                // just get the first channel
+                return devices.values().iterator().next();
+            }
+
+            public static void doSomethingInteresting(JSONObject message) {
+                String deviceUUID;
+                try {
+                    deviceUUID = message.getString("uuid");
+                    if (devices.get(deviceUUID) == null) {
+                        Map<String, Object> headers = new HashMap<String, Object>();
+                        headers.put(PubNubConstants.OPERATION, "WHERE_NOW");
+                        headers.put(PubNubConstants.UUID, deviceUUID);
+                        JSONObject response = (JSONObject)template.requestBodyAndHeaders(null, headers);
+                        JSONArray listofDeviceChannels = response.getJSONArray("channels");
+                        devices.put(deviceUUID, listofDeviceChannels.getString(0));
+                    }
+                } catch (JSONException e) {
+                }
+            }
+        }
+    }
+
+    public static class EventGeneratorBean {
+        public static String getRandomEvent(String device) throws JSONException {
+            Random rand = new Random();
+            String s = "{uuid:" + device + ", humidity:" + rand.nextInt(100) + ", temperature:" + rand.nextInt(40) + "}";
+            return s;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
new file mode 100644
index 0000000..0625453
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub.example;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.main.Main;
+
+public final class PubNubSensorExample {
+
+    private PubNubSensorExample() {
+    }
+
+    public static void main(String[] args) throws Exception {
+        Main main = new Main();
+        main.addRouteBuilder(new SensorRoute());
+        main.run();
+    }
+
+    static class SensorRoute extends RouteBuilder {
+        @Override
+        public void configure() throws Exception {
+            from("pubnub://pubsub:pubnub-sensor-network?subscriberKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}").to("mock:result");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/resources/log4j2.properties b/components/camel-pubnub/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..25b59c8
--- /dev/null
+++ b/components/camel-pubnub/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-pubnub-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 429ee4e..49a423c 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -220,6 +220,7 @@
     <module>camel-pgevent</module>
     <module>camel-printer</module>
     <module>camel-protobuf</module>
+    <module>camel-pubnub</module>
     <module>camel-quartz</module>
     <module>camel-quartz2</module>
     <module>camel-quickfix</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 65387c8..546f7ce 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -517,6 +517,7 @@
     <pgjdbc-ng-driver-version>0.7.1</pgjdbc-ng-driver-version>
     <powermock-version>1.6.6</powermock-version>
     <protobuf-version>3.1.0</protobuf-version>
+    <pubnub-version>3.7.4</pubnub-version>
     <qpid-bundle-version>0.28_1</qpid-bundle-version>
     <qpid-proton-j-version>0.16.0</qpid-proton-j-version>
     <qpid-proton-j-bundle-version>0.14.0</qpid-proton-j-bundle-version>


[07/11] camel git commit: refactor component and upgrade PubNub library

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java
deleted file mode 100644
index 10db410..0000000
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.pubnub.example;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.main.Main;
-import org.json.JSONObject;
-
-//@formatter:off
-/**
- * Just a small http server hack to try out pubnub method calls. 
- * HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH; 
- * usage : 
- * do a GET with http param CamelPubNubOperation=METHOD_TO_ACTIVATE eg. HERE_NOW 
- * 
- * SET_STATE requires a http param 'body' with some json that is used as pubnub state object. 
- * Can be any valid json string.
- *
- */
-//@formatter:on
-public final class PubNubOperationsExample {
-
-    private PubNubOperationsExample() {
-    }
-
-    public static void main(String[] args) throws Exception {
-        Main main = new Main();
-        main.addRouteBuilder(new RestRoute());
-        main.run();
-    }
-
-    static class RestRoute extends RouteBuilder {
-        private String pubnub = "pubnub://pubsub:iot?publisherKey=" + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY + "&subscriberKey="
-                                + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
-
-        @Override
-        public void configure() throws Exception {
-            //@formatter:off
-            from("netty-http:http://0.0.0.0:8080?urlDecodeHeaders=true")
-                .setBody(simple("${header.body}"))
-                .convertBodyTo(JSONObject.class)
-                .to(pubnub);
-            //@formatter:on
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
index 2122bf0..faac12c 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
@@ -19,6 +19,8 @@ package org.apache.camel.component.pubnub.example;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.main.Main;
 
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
+
 public final class PubNubPresenseExample {
 
     private PubNubPresenseExample() {
@@ -33,11 +35,9 @@ public final class PubNubPresenseExample {
     static class PresensRoute extends RouteBuilder {
         @Override
         public void configure() throws Exception {
-            //@formatter:off
-            from("pubnub://presence:iot?subscriberKey=" + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY)
+            from("pubnub:iot?withPresence=true&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY)
                 .log("${body}")
                 .to("mock:result");
-            //@formatter:on
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html
index 9794b0b..e962a4a 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html
@@ -15,73 +15,92 @@
  * limitations under the License.
 -->
 <html>
-  <head>
+<head>
 
-    <link rel="stylesheet" type="text/css" href="http://pubnub.github.io/eon/lib/eon.css">
-    <script src="http://cdn.pubnub.com/pubnub-3.7.1.min.js"></script>
-    <script src="http://pubnub.github.io/eon/lib/eon-chart.js"></script>
+<link rel="stylesheet" type="text/css" href="https://pubnub.github.io/eon/v/eon/1.0.0/eon.css">
+<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.6.0.min.js"></script>
+<script src="https://pubnub.github.io/eon/v/eon/1.0.0/eon.js"></script>
 
 
-    <style>
-      .c3-region-1 {
-        fill: #dd3333;
-        fill-opacity: 0.8
-      }
-    </style>
+<style>
+.c3-region-1 {
+    fill: #dd3333;
+    fill-opacity: 0.8
+}
+</style>
 
-  </head>
-  <body>
-  	<div>
-  		<div align="center">
-  		<h1>Description</h1>
-  		</div>
-  		<br/>
-  		This is a example of PubNub EON charts displaying stream data using the camel-pubnub component.
-  		<br/>
-  		To see live data you have to:
-  		<ul>
-  			<li>Sign up for a PubNub acount</li>
-  			<li>Replace the 'subscribe_key' in this html.</li>
-  			<li>Update the constants PUBNUB_SUBSCRIBER_KEY and PUBNUB_PUBLISHER_KEY in the class PubNubExampleConstants</li>
-  			<li>Run the class PubNubSensor2Example</li>
-  			
-  		</ul>
-  	</div>
+</head>
+<body>
+    <div>
+        <div align="center">
+            <h1>Description</h1>
+        </div>
+        <br /> This is a example of PubNub EON charts displaying stream data
+        using the camel-pubnub component. <br /> To see live data you have
+        to:
+        <ul>
+            <li>Sign up for a PubNub acount</li>
+            <li>Replace 'mySubscriberKey' in this html with a subscriberkey obtained from PubNub.</li>
+            <li>Update the constants PUBNUB_SUBSCRIBER_KEY and PUBNUB_PUBLISHER_KEY in the class PubNubExampleConstants</li>
+            <li>Run the class PubNubSensor2Example</li>
+            <li>Open this html page in your web browser</li>
+        </ul>
+    </div>
     <div id="chart"></div>
-    <script>
+<script>
 
-    var pubnub = PUBNUB.init({
-		subscribe_key: 'mysubscriberkey'
-	});
-    eon.chart({
-    	pubnub: pubnub,
-    	history: false,
-	    channel: 'iot',
-    	flow: true,
-    	generate: {
-    	    bindto: '#chart',
-    	    data: {
-				x: 'x',
-				labels: true
-    	    },
-    	    axis: {
-    	      	x: {
-	    	        type: 'timeseries',
-	    	        tick: {
-	    	            format: '%Y-%m-%d'
-	    	        }
-    	      	}
-    	    }
-    	},
-	    transform: function(m) {
-	    	var response = {columns: [
-	    		['x', new Date().getTime()],
-	    		['Humidity', m.humidity],
-	    		['Temperature', m.temperature]
-	    	]};
-	    	return response;
-	    }
-	});
+    var pubnub = new PubNub({
+        subscribeKey: 'mySubscriberKey'
+    });
+
+eon.chart({
+    channels: ["iot"],
+    generate: {
+        bindto: '#chart',
+        data: {
+            type:'spline',
+            colors: {
+                value0:'#ffaaaa',
+                value1:'#cc8888',
+            },
+            names: {
+                value0: "Temperature",
+                value1: "Humidity",
+            }
+        },
+        point: {
+            show: false
+        },
+        axis: {
+            x: {
+                type: 'timeseries',
+                tick: {
+                    format: '%H:%m:%S'
+                }
+            },
+            y: {
+                label: {
+                    text: 'Values',
+                    position: 'outer-middle'
+                }
+            }
+        },
+        tooltip: {
+            show: false
+        }
+    },
+    history:false,
+    pubnub: pubnub,
+    limit: 100,
+    transform: function(m) {
+      return { eon: {
+        temperature: m.temperature,
+        humidity: m.humidity
+      }}
+    }
+    
+});
+	
     </script>
-  </body>
+</body>
 </html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
index 01d51fa..7389193 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.java
@@ -21,14 +21,18 @@ import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.ConcurrentHashMap;
 
+import com.pubnub.api.models.consumer.pubsub.PNMessageResult;
+
 import org.apache.camel.EndpointInject;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.pubnub.PubNubConstants;
 import org.apache.camel.main.Main;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+
+import static org.apache.camel.component.pubnub.PubNubConstants.OPERATION;
+import static org.apache.camel.component.pubnub.PubNubConstants.UUID;
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_PUBLISHER_KEY;
+import static org.apache.camel.component.pubnub.example.PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
 
 public final class PubNubSensor2Example {
 
@@ -43,37 +47,29 @@ public final class PubNubSensor2Example {
     }
 
     static class SimulatedDeviceEventGeneratorRoute extends RouteBuilder {
-        private final String deviceEP = "pubnub://pubsub:iot?uuid=device2&publisherKey=" + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY + "&subscriberKey="
-                                        + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
-        private final String devicePrivateEP = "pubnub://pubsub:device2private?uuid=device2&publisherKey=" + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY + "&subscriberKey="
-                                               + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
+        private final String deviceEP = "pubnub:iot?uuid=device2&publisherKey=" + PUBNUB_PUBLISHER_KEY + "&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY;
+        private final String devicePrivateEP = "pubnub:device2private?uuid=device2&publisherKey=" + PUBNUB_PUBLISHER_KEY + "&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY;
 
         @Override
         public void configure() throws Exception {
-            //@formatter:off
             from("timer:device2").routeId("device-event-route")
                 .bean(PubNubSensor2Example.EventGeneratorBean.class, "getRandomEvent('device2')")
-                .convertBodyTo(JSONObject.class)
                 .to(deviceEP);
             
             from(devicePrivateEP)
                 .routeId("device-unicast-route")
                 .log("Message from master to device2 : ${body}");
-            //@formatter:on
         }
     }
 
     static class PubsubRoute extends RouteBuilder {
-        private static String masterEP = "pubnub://pubsub:iot?uuid=master&subscriberKey=" + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY + "&publisherKey="
-                                         + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY;
+        private static String masterEP = "pubnub:iot?uuid=master&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY + "&publisherKey=" + PUBNUB_PUBLISHER_KEY;
         private static Map<String, String> devices = new ConcurrentHashMap<String, String>();
 
         @Override
         public void configure() throws Exception {
-            //@formatter:off
             from(masterEP)
                 .routeId("master-route")
-                .convertBodyTo(JSONObject.class)
                 .bean(PubNubSensor2Example.PubsubRoute.DataProcessorBean.class, "doSomethingInteresting(${body})")
                 .log("${body} headers : ${headers}").to("mock:result");
             
@@ -82,11 +78,10 @@ public final class PubNubSensor2Example {
                 .setHeader(PubNubConstants.CHANNEL, method(PubNubSensor2Example.PubsubRoute.DataProcessorBean.class, "getUnicastChannelOfDevice()"))
                 .setBody(constant("Hello device"))
                 .to(masterEP);
-            //@formatter:on
         }
 
-        static class DataProcessorBean {
-            @EndpointInject(uri = "pubnub://pubsub:iot?uuid=master&subscriberKey=" + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY)
+        public static class DataProcessorBean {
+            @EndpointInject(uri = "pubnub:iot?uuid=master&subscriberKey=" + PUBNUB_SUBSCRIBER_KEY)
             private static ProducerTemplate template;
 
             public static String getUnicastChannelOfDevice() {
@@ -94,29 +89,50 @@ public final class PubNubSensor2Example {
                 return devices.values().iterator().next();
             }
 
-            public static void doSomethingInteresting(JSONObject message) {
+            public static void doSomethingInteresting(PNMessageResult message) {
                 String deviceUUID;
-                try {
-                    deviceUUID = message.getString("uuid");
-                    if (devices.get(deviceUUID) == null) {
-                        Map<String, Object> headers = new HashMap<String, Object>();
-                        headers.put(PubNubConstants.OPERATION, "WHERE_NOW");
-                        headers.put(PubNubConstants.UUID, deviceUUID);
-                        JSONObject response = (JSONObject)template.requestBodyAndHeaders(null, headers);
-                        JSONArray listofDeviceChannels = response.getJSONArray("channels");
-                        devices.put(deviceUUID, listofDeviceChannels.getString(0));
-                    }
-                } catch (JSONException e) {
+                deviceUUID = message.getPublisher();
+                if (devices.get(deviceUUID) == null) {
+                    Map<String, Object> headers = new HashMap<String, Object>();
+                    headers.put(OPERATION, "WHERE_NOW");
+                    headers.put(UUID, deviceUUID);
+                    @SuppressWarnings("unchecked")
+                    java.util.List<String> channels = (java.util.List<String>) template.requestBodyAndHeaders(null, headers);
+                    devices.put(deviceUUID, channels.get(0));
                 }
             }
         }
     }
 
-    public static class EventGeneratorBean {
-        public static String getRandomEvent(String device) throws JSONException {
+    static class DeviceWeatherInfo {
+        private String device;
+        private int humidity;
+        private int temperature;
+
+        DeviceWeatherInfo(String device) {
             Random rand = new Random();
-            String s = "{uuid:" + device + ", humidity:" + rand.nextInt(100) + ", temperature:" + rand.nextInt(40) + "}";
-            return s;
+            this.device = device;
+            this.humidity = rand.nextInt(100);
+            this.temperature = rand.nextInt(40);
+        }
+
+        public String getDevice() {
+            return device;
+        }
+
+        public int getHumidity() {
+            return humidity;
+        }
+
+        public int getTemperature() {
+            return temperature;
+        }
+
+    }
+
+    public static class EventGeneratorBean {
+        public static DeviceWeatherInfo getRandomEvent(String device) {
+            return new DeviceWeatherInfo(device);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
index 0625453..f5cff83 100644
--- a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensorExample.java
@@ -33,7 +33,7 @@ public final class PubNubSensorExample {
     static class SensorRoute extends RouteBuilder {
         @Override
         public void configure() throws Exception {
-            from("pubnub://pubsub:pubnub-sensor-network?subscriberKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}").to("mock:result");
+            from("pubnub:pubnub-sensor-network?subscriberKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}").to("mock:result");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/components/camel-pubnub/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/resources/log4j2.properties b/components/camel-pubnub/src/test/resources/log4j2.properties
index 25b59c8..fbb9b06 100644
--- a/components/camel-pubnub/src/test/resources/log4j2.properties
+++ b/components/camel-pubnub/src/test/resources/log4j2.properties
@@ -25,4 +25,4 @@ appender.out.name = out
 appender.out.layout.type = PatternLayout
 appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
 rootLogger.level = INFO
-rootLogger.appenderRef.file.ref = file
+rootLogger.appenderRef.file.ref = out

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 546f7ce..0b46f85 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -517,7 +517,7 @@
     <pgjdbc-ng-driver-version>0.7.1</pgjdbc-ng-driver-version>
     <powermock-version>1.6.6</powermock-version>
     <protobuf-version>3.1.0</protobuf-version>
-    <pubnub-version>3.7.4</pubnub-version>
+    <pubnub-version>4.6.0</pubnub-version>
     <qpid-bundle-version>0.28_1</qpid-bundle-version>
     <qpid-proton-j-version>0.16.0</qpid-proton-j-version>
     <qpid-proton-j-bundle-version>0.14.0</qpid-proton-j-bundle-version>

http://git-wip-us.apache.org/repos/asf/camel/blob/13042923/platforms/spring-boot/components-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index 78ca1c2..b0f7a5a 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -236,6 +236,7 @@
     <module>camel-pgevent-starter</module>
     <module>camel-printer-starter</module>
     <module>camel-protobuf-starter</module>
+    <module>camel-pubnub-starter</module>
     <module>camel-quartz2-starter</module>
     <module>camel-quickfix-starter</module>
     <module>camel-rabbitmq-starter</module>


[10/11] camel git commit: Remove camel-core-xml as spring boot starter as its not intended for standalone

Posted by da...@apache.org.
Remove camel-core-xml as spring boot starter as its not intended for standalone


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6b96ca3c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6b96ca3c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6b96ca3c

Branch: refs/heads/master
Commit: 6b96ca3c4a861b5e8d1165ba4871346e10264a9c
Parents: b1eb86f
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 21:24:04 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 .../camel-core-xml-starter/pom.xml              |  51 -----
 .../src/main/resources/META-INF/LICENSE.txt     | 203 -------------------
 .../src/main/resources/META-INF/NOTICE.txt      |  11 -
 .../src/main/resources/META-INF/spring.provides |  18 --
 .../spring-boot/components-starter/pom.xml      |   1 -
 .../maven/packaging/SpringBootStarterMojo.java  |   2 +-
 6 files changed, 1 insertion(+), 285 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6b96ca3c/platforms/spring-boot/components-starter/camel-core-xml-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-xml-starter/pom.xml b/platforms/spring-boot/components-starter/camel-core-xml-starter/pom.xml
deleted file mode 100644
index 3e535b1..0000000
--- a/platforms/spring-boot/components-starter/camel-core-xml-starter/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>components-starter</artifactId>
-    <version>2.19.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>camel-core-xml-starter</artifactId>
-  <packaging>jar</packaging>
-  <name>Spring-Boot Starter :: Camel :: Core XML</name>
-  <description>Spring-Boot Starter for Camel Core XML support</description>
-  <dependencies>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter</artifactId>
-      <version>${spring-boot-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-core-xml</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <!--START OF GENERATED CODE-->
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-core-starter</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring-boot-starter</artifactId>
-    </dependency>
-    <!--END OF GENERATED CODE-->
-  </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/6b96ca3c/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-

http://git-wip-us.apache.org/repos/asf/camel/blob/6b96ca3c/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Apache Camel distribution.                    ==
-   =========================================================================
-
-   This product includes software developed by
-   The Apache Software Foundation (http://www.apache.org/).
-
-   Please read the different LICENSE files present in the licenses directory of
-   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/6b96ca3c/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/spring.provides
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/spring.provides
deleted file mode 100644
index c25b959..0000000
--- a/platforms/spring-boot/components-starter/camel-core-xml-starter/src/main/resources/META-INF/spring.provides
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-provides: camel-core-xml
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/6b96ca3c/platforms/spring-boot/components-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index b0f7a5a..d0be1fb 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -107,7 +107,6 @@
     <module>camel-consul-starter</module>
     <module>camel-context-starter</module>
     <module>camel-core-starter</module>
-    <module>camel-core-xml-starter</module>
     <module>camel-couchbase-starter</module>
     <module>camel-couchdb-starter</module>
     <module>camel-crypto-starter</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/6b96ca3c/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
index 0797846..4f91b90 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
@@ -85,7 +85,7 @@ public class SpringBootStarterMojo extends AbstractMojo {
         /* Java EE -> */ "camel-cdi", "camel-ejb",
         /* deprecated (and not working perfectly) -> */ "camel-swagger", "camel-mina", "camel-ibatis", "camel-quartz",
         /* currently incompatible */ "camel-jclouds", "camel-spark-rest",
-        /* others (not managed) -> */ "camel-groovy-dsl", "camel-scala"};
+        /* others (not managed) -> */ "camel-core-xml", "camel-groovy-dsl", "camel-scala"};
 
     private static final boolean IGNORE_TEST_MODULES = true;
 


[05/11] camel git commit: initial commit of camel-pubnub component

Posted by da...@apache.org.
initial commit of camel-pubnub component

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/289a6728
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/289a6728
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/289a6728

Branch: refs/heads/master
Commit: 289a67285a21e6f48cfd8857953ba88b1a4993e9
Parents: 5148409
Author: Preben Asmussen <pr...@gmail.com>
Authored: Fri Mar 24 22:49:13 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 21:56:07 2017 +0200

----------------------------------------------------------------------
 components/camel-pubnub/pom.xml                 |  80 +++++++
 .../camel/component/pubnub/JsonConverter.java   |  46 ++++
 .../camel/component/pubnub/PubNubComponent.java |  54 +++++
 .../component/pubnub/PubNubConfiguration.java   | 146 +++++++++++++
 .../camel/component/pubnub/PubNubConstants.java |  24 ++
 .../camel/component/pubnub/PubNubConsumer.java  | 120 ++++++++++
 .../camel/component/pubnub/PubNubEndpoint.java  | 218 +++++++++++++++++++
 .../component/pubnub/PubNubEndpointType.java    |  32 +++
 .../camel/component/pubnub/PubNubProducer.java  | 146 +++++++++++++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 +++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../services/org/apache/camel/TypeConverter     |  18 ++
 .../services/org/apache/camel/component/pubnub  |  17 ++
 .../component/pubnub/PubNubComponentTest.java   |  61 ++++++
 .../pubnub/PubNubConfigurationTest.java         |  55 +++++
 .../pubnub/PubNubEmptyPayloadTest.java          |  55 +++++
 .../camel/component/pubnub/PubNubMock.java      | 186 ++++++++++++++++
 .../component/pubnub/PubNubOperationsTest.java  |  91 ++++++++
 .../component/pubnub/PubNubPresensTest.java     |  72 ++++++
 .../pubnub/example/PubNubExampleConstants.java  |  24 ++
 .../pubnub/example/PubNubOperationsExample.java |  61 ++++++
 .../pubnub/example/PubNubPresenseExample.java   |  44 ++++
 .../pubnub/example/PubNubSensor2Example.html    |  87 ++++++++
 .../pubnub/example/PubNubSensor2Example.java    | 122 +++++++++++
 .../pubnub/example/PubNubSensorExample.java     |  40 ++++
 .../src/test/resources/log4j2.properties        |  28 +++
 components/pom.xml                              |   1 +
 parent/pom.xml                                  |   1 +
 28 files changed, 2043 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/pom.xml b/components/camel-pubnub/pom.xml
new file mode 100644
index 0000000..268cb2a
--- /dev/null
+++ b/components/camel-pubnub/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+  license agreements. See the NOTICE file distributed with this work for additional 
+  information regarding copyright ownership. The ASF licenses this file to 
+  You under the Apache License, Version 2.0 (the "License"); you may not use 
+  this file except in compliance with the License. You may obtain a copy of 
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+  by applicable law or agreed to in writing, software distributed under the 
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+  OF ANY KIND, either express or implied. See the License for the specific 
+  language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-pubnub</artifactId>
+  <packaging>jar</packaging>
+
+  <name>Camel :: PubNub</name>
+  <description>Camel PubNub component</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.component.pubnub.*</camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=pubnub</camel.osgi.export.service>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.pubnub</groupId>
+      <artifactId>pubnub</artifactId>
+      <version>${pubnub-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>${gson-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>${commons-lang3-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.json</groupId>
+      <artifactId>json</artifactId>
+      <version>20160810</version>
+    </dependency>
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-netty-http</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java
new file mode 100644
index 0000000..e5f09a0
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/JsonConverter.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import org.apache.camel.Converter;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+@Converter
+public final class JsonConverter {
+    private JsonConverter() {
+    }
+
+    @Converter
+    public static JSONObject toJsonObject(String json) {
+        try {
+            return new JSONObject(json);
+        } catch (JSONException e) {
+            return null;
+        }
+    }
+
+    @Converter
+    public static JSONArray toJsonArray(String json) {
+        try {
+            return new JSONArray(json);
+        } catch (JSONException e) {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
new file mode 100644
index 0000000..9eb4e61
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubComponent.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+
+/**
+ * Represents the component that manages {@link PubNubEndpoint}.
+ */
+public class PubNubComponent extends DefaultComponent {
+
+    public PubNubComponent(CamelContext context) {
+        super(context);
+    }
+
+    public PubNubComponent() {
+        super();
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        String[] uriParts = remaining.split(":");
+        if (uriParts.length != 2) {
+            throw new IllegalArgumentException("Invalid Endpoint URI: " + uri + ". It should contains a valid endpointType and channel");
+        }
+        PubNubEndpointType endpointType = PubNubEndpointType.valueOf(uriParts[0]);
+        String channel = uriParts[1];
+
+        PubNubEndpoint endpoint = new PubNubEndpoint(uri, this);
+        setProperties(endpoint, parameters);
+        endpoint.setEndpointType(endpointType);
+        endpoint.setChannel(channel);
+        return endpoint;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
new file mode 100644
index 0000000..b506508
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConfiguration.java
@@ -0,0 +1,146 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import com.pubnub.api.Pubnub;
+
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+
+@UriParams
+public class PubNubConfiguration {
+    @UriParam
+    private Pubnub pubnub;
+
+    @UriPath(enums = "pubsub,presence")
+    @Metadata(required = "true", defaultValue = "pubsub")
+    private PubNubEndpointType endpointType = PubNubEndpointType.pubsub;
+
+    @UriPath()
+    @Metadata(required = "true")
+    private String channel;
+
+    @UriParam()
+    private String publisherKey;
+
+    @UriParam()
+    private String subscriberKey;
+
+    @UriParam()
+    private String secretKey;
+
+    @UriParam(defaultValue = "true")
+    private boolean ssl = true;
+
+    @UriParam()
+    private String uuid;
+
+    @UriParam(label = "producer", enums = "HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH")
+    private String operation;
+
+    public PubNubEndpointType getEndpointType() {
+        return endpointType;
+    }
+
+    /**
+     * The publish key obtained from your PubNub account. Required when publishing messages.
+     */
+    public String getPublisherKey() {
+        return publisherKey;
+    }
+
+    public void setPublisherKey(String publisherKey) {
+        this.publisherKey = publisherKey;
+    }
+
+    /**
+     * The subscribe key obtained from your PubNub account. Required when subscribing to channels or listening for presence events
+     */
+    public String getSubscriberKey() {
+        return subscriberKey;
+    }
+
+    public void setSubscriberKey(String subscriberKey) {
+        this.subscriberKey = subscriberKey;
+    }
+
+    /**
+     * The secret key used for message signing.
+     */
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public void setSecretKey(String secretKey) {
+        this.secretKey = secretKey;
+    }
+
+    /**
+     * Use ssl
+     */
+    public boolean isSsl() {
+        return ssl;
+    }
+
+    public void setSsl(boolean ssl) {
+        this.ssl = ssl;
+    }
+
+    /**
+     * The channel used for subscribing/publishing events
+     */
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
+    /**
+     * The uuid identifying the connection. Will be auto assigned if not set.
+     */
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    /**
+     * The operation to perform.
+     */
+    public void setOperation(String operation) {
+        this.operation = operation;
+    }
+
+    public String getOperation() {
+        return operation;
+    }
+
+    public Pubnub getPubnub() {
+        return pubnub;
+    }
+
+    public void setPubnub(Pubnub pubnub) {
+        this.pubnub = pubnub;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java
new file mode 100644
index 0000000..30adae0
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConstants.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+public interface PubNubConstants {
+    String OPERATION = "CamelPubNubOperation";
+    String TIMETOKEN = "CamelPubNubTimeToken";
+    String CHANNEL = "CamelPubNubChannel";
+    String UUID = "CamelPubNubUUID";
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
new file mode 100644
index 0000000..8b8002a
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubConsumer.java
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import com.pubnub.api.Callback;
+import com.pubnub.api.PubnubError;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultConsumer;
+import org.apache.camel.impl.DefaultExchange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The PubNub consumer.
+ */
+public class PubNubConsumer extends DefaultConsumer {
+    private static final Logger LOG = LoggerFactory.getLogger(PubNubConsumer.class);
+    private final PubNubEndpoint endpoint;
+
+    public PubNubConsumer(PubNubEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    private void initCommunication() throws Exception {
+        if (endpoint.getEndpointType().equals(PubNubEndpointType.pubsub)) {
+            endpoint.getPubnub().subscribe(endpoint.getChannel(), new PubNubCallback());
+        } else {
+            endpoint.getPubnub().presence(endpoint.getChannel(), new PubNubCallback());
+        }
+    }
+
+    private void terminateCommunication() throws Exception {
+        if (endpoint.getEndpointType().equals(PubNubEndpointType.pubsub)) {
+            endpoint.getPubnub().unsubscribe(endpoint.getChannel());
+        } else {
+            endpoint.getPubnub().unsubscribePresence(endpoint.getChannel());
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        initCommunication();
+    }
+
+    @Override
+    protected void doResume() throws Exception {
+        super.doResume();
+        initCommunication();
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        terminateCommunication();
+        super.doStop();
+    }
+
+    @Override
+    protected void doSuspend() throws Exception {
+        terminateCommunication();
+        super.doSuspend();
+    }
+
+    private class PubNubCallback extends Callback {
+
+        @Override
+        public void successCallback(String channel, Object objectMessage, String timetoken) {
+            Exchange exchange = new DefaultExchange(endpoint, endpoint.getExchangePattern());
+            Message message = exchange.getIn();
+            message.setBody(objectMessage);
+            message.setHeader(PubNubConstants.TIMETOKEN, timetoken);
+            message.setHeader(PubNubConstants.CHANNEL, channel);
+            try {
+                getProcessor().process(exchange);
+            } catch (Exception e) {
+                exchange.setException(e);
+                getExceptionHandler().handleException("Error processing exchange", exchange, e);
+            }
+        }
+
+        @Override
+        public void connectCallback(String channel, Object message) {
+            LOG.info("Subscriber : Successfully connected to PubNub channel {}", channel);
+        }
+
+        @Override
+        public void errorCallback(String channel, PubnubError error) {
+            LOG.error("Subscriber : Error [{}] received from PubNub on channel {}", error, channel);
+        }
+
+        @Override
+        public void reconnectCallback(String channel, Object message) {
+            LOG.info("Subscriber : Reconnected to PubNub channel {}", channel);
+        }
+
+        @Override
+        public void disconnectCallback(String channel, Object message) {
+            LOG.trace("Subscriber : Disconnected from PubNub channel {}", channel);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
new file mode 100644
index 0000000..2f60d2a
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java
@@ -0,0 +1,218 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import com.pubnub.api.Pubnub;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.ObjectHelper;
+
+@UriEndpoint(scheme = "pubnub", title = "PubNub", syntax = "pubnub:endpointType:channel", consumerClass = PubNubConsumer.class, label = "cloud,iot,messaging")
+public class PubNubEndpoint extends DefaultEndpoint {
+
+    @UriParam
+    private Pubnub pubnub;
+
+    @UriPath(enums = "pubsub,presence")
+    @Metadata(required = "true")
+    private PubNubEndpointType endpointType = PubNubEndpointType.pubsub;
+
+    @UriPath()
+    @Metadata(required = "true")
+    private String channel;
+
+    @UriParam()
+    private String publisherKey;
+
+    @UriParam()
+    private String subscriberKey;
+
+    @UriParam()
+    private String secretKey;
+
+    @UriParam(defaultValue = "true")
+    private boolean ssl = true;
+
+    @UriParam()
+    private String uuid;
+
+    @UriParam(label = "producer", enums = "HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH")
+    private String operation;
+
+    public PubNubEndpoint(String uri, PubNubComponent component) {
+        super(uri, component);
+    }
+
+    
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return new PubNubProducer(this);
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        return new PubNubConsumer(this, processor);
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    /**
+     * The type endpoint type. Either pubsub or presence
+     */
+
+    public PubNubEndpointType getEndpointType() {
+        return endpointType;
+    }
+
+    public void setEndpointType(PubNubEndpointType endpointType) {
+        this.endpointType = endpointType;
+    }
+
+    /**
+     * The pubnub publish key obtained from your pubnub account. Required when
+     * publishing messages.
+     */
+    public String getPublisherKey() {
+        return publisherKey;
+    }
+
+    public void setPublisherKey(String publisherKey) {
+        this.publisherKey = publisherKey;
+    }
+
+    /**
+     * The pubnub subscribe key obtained from your pubnub account. Required when
+     * subscribing to channels or listening for presence events
+     */
+    public String getSubscriberKey() {
+        return subscriberKey;
+    }
+
+    public void setSubscriberKey(String subscriberKey) {
+        this.subscriberKey = subscriberKey;
+    }
+
+    /**
+     * The pubnub secret key used for message signing.
+     */
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public void setSecretKey(String secretKey) {
+        this.secretKey = secretKey;
+    }
+
+    /**
+     * Use ssl
+     */
+    public boolean isSsl() {
+        return ssl;
+    }
+
+    public void setSsl(boolean ssl) {
+        this.ssl = ssl;
+    }
+
+    /**
+     * The channel used for subscribing/publishing events
+     */
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
+    /**
+     * The uuid identifying the connection. Will be auto assigned if not set.
+     */
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    /**
+     * The operation to perform.
+     */
+    public void setOperation(String operation) {
+        this.operation = operation;
+    }
+
+    public String getOperation() {
+        return operation;
+    }
+
+    /**
+     * Reference to a Pubnub client in the registry.
+     */
+
+    public Pubnub getPubnub() {
+        return pubnub;
+    }
+
+    public void setPubnub(Pubnub pubnub) {
+        this.pubnub = pubnub;
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        super.doStop();
+        if (pubnub != null) {
+            pubnub.shutdown();
+            pubnub = null;
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        this.pubnub = getPubnub() != null ? getPubnub() : getInstance();
+        super.doStart();
+    }
+
+    private Pubnub getInstance() {
+        Pubnub answer = null;
+        if (ObjectHelper.isNotEmpty(getSecretKey())) {
+            answer = new Pubnub(getPublisherKey(), getSubscriberKey(), getSecretKey(), isSsl());
+        } else {
+            answer = new Pubnub(getPublisherKey(), getSubscriberKey(), isSsl());
+        }
+        if (ObjectHelper.isNotEmpty(getUuid())) {
+            answer.setUUID(getUuid());
+        } else {
+            String autoUUID = answer.uuid();
+            setUuid(autoUUID);
+            answer.setUUID(autoUUID);
+        }
+        return answer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java
new file mode 100644
index 0000000..1454b33
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpointType.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+public enum PubNubEndpointType {
+    pubsub("pubsub"), presence("presence");
+
+    private final String text;
+
+    PubNubEndpointType(final String text) {
+        this.text = text;
+    }
+
+    @Override
+    public String toString() {
+        return text;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
new file mode 100644
index 0000000..c2fb85c
--- /dev/null
+++ b/components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubProducer.java
@@ -0,0 +1,146 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import com.pubnub.api.Callback;
+import com.pubnub.api.PubnubError;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelException;
+import org.apache.camel.Exchange;
+import org.apache.camel.InvalidPayloadException;
+import org.apache.camel.impl.DefaultAsyncProducer;
+import org.apache.camel.util.ObjectHelper;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The PubNub producer.
+ */
+public class PubNubProducer extends DefaultAsyncProducer {
+    private static final Logger LOG = LoggerFactory.getLogger(PubNubProducer.class);
+    private final PubNubEndpoint endpoint;
+
+    public PubNubProducer(PubNubEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    public boolean process(final Exchange exchange, final AsyncCallback callback) {
+        Callback pubnubCallback = pubnubCallback(exchange, callback);
+
+        Operation operation = getOperation(exchange);
+        LOG.trace("Executing {} operation", operation);
+        switch (operation) {
+        case PUBLISH: {
+            String channel = exchange.getIn().getHeader(PubNubConstants.CHANNEL, String.class);
+            channel = channel != null ? channel : endpoint.getChannel();
+            Object body = exchange.getIn().getBody();
+            if (ObjectHelper.isEmpty(body)) {
+                exchange.setException(new CamelException("Can not publish empty message"));
+                callback.done(true);
+                return true;
+            }
+            LOG.trace("Sending message [{}] to channel [{}]", body, channel);
+            if (body.getClass().isAssignableFrom(JSONObject.class)) {
+                endpoint.getPubnub().publish(channel, (JSONObject)body, pubnubCallback);
+            } else if (body.getClass().isAssignableFrom(JSONArray.class)) {
+                endpoint.getPubnub().publish(channel, (JSONArray)body, pubnubCallback);
+            } else {
+                try {
+                    endpoint.getPubnub().publish(channel, exchange.getIn().getMandatoryBody(String.class), pubnubCallback);
+                } catch (InvalidPayloadException e) {
+                    exchange.setException(e);
+                    callback.done(true);
+                    return true;
+                }
+            }
+            break;
+        }
+        case GET_HISTORY: {
+            endpoint.getPubnub().history(endpoint.getChannel(), false, pubnubCallback);
+            break;
+        }
+        case GET_STATE: {
+            String uuid = exchange.getIn().getHeader(PubNubConstants.UUID, String.class);
+            endpoint.getPubnub().getState(endpoint.getChannel(), uuid != null ? uuid : endpoint.getUuid(), pubnubCallback);
+            break;
+        }
+        case HERE_NOW: {
+            endpoint.getPubnub().hereNow(endpoint.getChannel(), true, true, pubnubCallback);
+            break;
+        }
+        case SET_STATE: {
+            try {
+                JSONObject state = exchange.getIn().getMandatoryBody(JSONObject.class);
+                String uuid = exchange.getIn().getHeader(PubNubConstants.UUID, String.class);
+                endpoint.getPubnub().setState(endpoint.getChannel(), uuid != null ? uuid : endpoint.getUuid(), state, pubnubCallback);
+            } catch (InvalidPayloadException e) {
+                exchange.setException(e);
+                callback.done(true);
+                return true;
+            }
+            break;
+        }
+        case WHERE_NOW: {
+            String uuid = exchange.getIn().getHeader(PubNubConstants.UUID, String.class);
+            endpoint.getPubnub().whereNow(uuid != null ? uuid : endpoint.getUuid(), pubnubCallback);
+            break;
+        }
+        default:
+            throw new UnsupportedOperationException(operation.toString());
+        }
+        return false;
+    }
+
+    private Callback pubnubCallback(final Exchange exchange, final AsyncCallback callback) {
+        Callback pubnubCallback = new Callback() {
+            @Override
+            public void successCallback(String channel, Object message) {
+                LOG.trace("PubNub response {}", message);
+                exchange.getIn().setHeader(PubNubConstants.CHANNEL, channel);
+                if (exchange.getPattern().isOutCapable()) {
+                    exchange.getOut().copyFrom(exchange.getIn());
+                    exchange.getOut().setBody(message);
+                }
+                callback.done(false);
+            }
+
+            @Override
+            public void errorCallback(String channel, PubnubError error) {
+                exchange.setException(new CamelException(error.toString()));
+                callback.done(false);
+            }
+        };
+        return pubnubCallback;
+    }
+
+    private Operation getOperation(Exchange exchange) {
+        String operation = exchange.getIn().getHeader(PubNubConstants.OPERATION, String.class);
+        if (operation == null) {
+            operation = endpoint.getOperation();
+        }
+        return operation != null ? Operation.valueOf(operation) : Operation.PUBLISH;
+    }
+
+    private enum Operation {
+        HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/resources/META-INF/LICENSE.txt b/components/camel-pubnub/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/components/camel-pubnub/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/resources/META-INF/NOTICE.txt b/components/camel-pubnub/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/components/camel-pubnub/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
new file mode 100644
index 0000000..ebdd694
--- /dev/null
+++ b/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.camel.component.pubnub
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub b/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub
new file mode 100644
index 0000000..1e8433c
--- /dev/null
+++ b/components/camel-pubnub/src/main/resources/META-INF/services/org/apache/camel/component/pubnub
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+class=org.apache.camel.component.pubnub.PubNubComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java
new file mode 100644
index 0000000..664bafe
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubComponentTest.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.json.JSONObject;
+import org.junit.Test;
+
+public class PubNubComponentTest extends CamelTestSupport {
+    private String endpoint = "pubnub:pubsub:someChannel?pubnub=#pubnub";
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockResult;
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
+        return registry;
+    }
+
+    @Test
+    public void testPubNub() throws Exception {
+        mockResult.expectedMessageCount(1);
+        mockResult.expectedHeaderReceived("CamelPubNubChannel", "someChannel");
+        mockResult.expectedBodiesReceived("{\"hi\":\"there\"}");
+        JSONObject jo = new JSONObject();
+        jo.put("hi", "there");
+        template.sendBody("direct:publish", jo);
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from(endpoint).to("mock:result");
+                from("direct:publish").to(endpoint);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
new file mode 100644
index 0000000..23e5c56
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubConfigurationTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class PubNubConfigurationTest extends CamelTestSupport {
+
+    @Test(expected = IllegalArgumentException.class)
+    public void createEndpointWithIllegalArguments() throws Exception {
+        PubNubComponent component = new PubNubComponent(context);
+        component.createEndpoint("pubnub:XXX:xxx");
+    }
+
+    @Test
+    public void createEndpointWithMinimalConfiguration() throws Exception {
+        PubNubComponent component = new PubNubComponent(context);
+        PubNubEndpoint endpoint = (PubNubEndpoint) component.createEndpoint("pubnub://pubsub:xxx?subscriberKey=mysubkey");
+
+        assertEquals("xxx", endpoint.getChannel());
+        assertEquals("mysubkey", endpoint.getSubscriberKey());
+        assertTrue(endpoint.isSsl());
+    }
+
+    @Test
+    public void createEndpointWithMaximalConfiguration() throws Exception {
+        PubNubComponent component = new PubNubComponent(context);
+        PubNubEndpoint endpoint = (PubNubEndpoint)component
+            .createEndpoint("pubnub://pubsub:xxx?subscriberKey=mysubkey&publisherKey=mypubkey&secretKey=secrets&uuid=myuuid&operation=PUBLISH&ssl=false");
+
+        assertEquals("xxx", endpoint.getChannel());
+        assertEquals("mysubkey", endpoint.getSubscriberKey());
+        assertEquals("mypubkey", endpoint.getPublisherKey());
+        assertEquals("secrets", endpoint.getSecretKey());
+        assertEquals("myuuid", endpoint.getUuid());
+        assertEquals("PUBLISH", endpoint.getOperation());
+        assertFalse(endpoint.isSsl());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java
new file mode 100644
index 0000000..d641259
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubEmptyPayloadTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class PubNubEmptyPayloadTest extends CamelTestSupport {
+    private final String endpoint = "pubnub:pubsub:someChannel?pubnub=#pubnub";
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockResult;
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
+        return registry;
+    }
+
+    @Test(expected = CamelExecutionException.class)
+    public void testPubNub() throws Exception {
+        template.sendBody("direct:publish", null);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:publish").to(endpoint);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java
new file mode 100644
index 0000000..f7b6917
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubMock.java
@@ -0,0 +1,186 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.pubnub;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import com.pubnub.api.Callback;
+import com.pubnub.api.Pubnub;
+import com.pubnub.api.PubnubException;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+public class PubNubMock extends Pubnub {
+    private static Map<String, Callback> subscribers = new ConcurrentHashMap<String, Callback>();
+    private static Map<String, Callback> presenceSubscribers = new ConcurrentHashMap<String, Callback>();
+    private static Map<String, JSONObject> stateMap = new ConcurrentHashMap<String, JSONObject>();
+    private final ExecutorService executorService = Executors.newFixedThreadPool(3);
+
+    public PubNubMock(String publishKey, String subscribeKey) {
+        super(publishKey, subscribeKey);
+    }
+
+    @Override
+    public void subscribe(String channel, Callback callback) throws PubnubException {
+        subscribers.put(channel, callback);
+        executorService.execute(() -> {
+            try {
+                Thread.sleep(500);
+                callback.connectCallback(channel, "OK");
+            } catch (InterruptedException e) {
+            }
+        });
+        Callback presenceCallback = presenceSubscribers.get(channel);
+        if (presenceCallback != null) {
+            executorService.execute(() -> {
+                try {
+                    Thread.sleep(500);
+                    String presence = "{\"action\":\"join\",\"timestamp\":1431777382,\"uuid\":\"d08f121b-d146-45af-a814-058c1b7d283a\",\"occupancy\":1}";
+                    presenceCallback.successCallback(channel, new JSONObject(presence), "" + System.currentTimeMillis());
+                } catch (Exception e) {
+                }
+            });
+        }
+    }
+
+    @Override
+    public void publish(String channel, JSONObject message, Callback callback) {
+        callback.successCallback(channel, "OK");
+        Callback clientMockCallback = subscribers.get(channel);
+        if (clientMockCallback != null) {
+            executorService.execute(() -> {
+                try {
+                    Thread.sleep(1000);
+                    clientMockCallback.successCallback(channel, message, "" + System.currentTimeMillis());
+                } catch (InterruptedException e) {
+                }
+            });
+        }
+    }
+
+    @Override
+    public void publish(String channel, JSONArray message, Callback callback) {
+        callback.successCallback(channel, "OK");
+        Callback clientMockCallback = subscribers.get(channel);
+        if (clientMockCallback != null) {
+            executorService.execute(() -> {
+                try {
+                    Thread.sleep(1000);
+                    clientMockCallback.successCallback(channel, message, "" + System.currentTimeMillis());
+                } catch (InterruptedException e) {
+                }
+            });
+        }
+    }
+
+    @Override
+    public void publish(String channel, String message, Callback callback) {
+        callback.successCallback(channel, "OK");
+        Callback clientMockCallback = subscribers.get(channel);
+        if (clientMockCallback != null) {
+            executorService.execute(() -> {
+                try {
+                    Thread.sleep(1000);
+                    clientMockCallback.successCallback(channel, message, "" + System.currentTimeMillis());
+                } catch (InterruptedException e) {
+                }
+            });
+        }
+    }
+
+    @Override
+    public void presence(String channel, Callback callback) throws PubnubException {
+        presenceSubscribers.put(channel, callback);
+        executorService.execute(() -> {
+            try {
+                Thread.sleep(1000);
+                callback.connectCallback(channel, "OK");
+            } catch (InterruptedException e) {
+            }
+        });
+    }
+
+    @Override
+    public void history(String channel, boolean reverse, Callback callback) {
+        executorService.execute(() -> {
+            try {
+                Thread.sleep(1000);
+                callback.successCallback(channel, new JSONArray("[[\"message1\", \"message2\", \"message3\"],\"Start Time Token\",\"End Time Token\"]"));
+            } catch (Exception e) {
+            }
+        });
+    }
+
+    @Override
+    public void setState(String channel, String uuid, JSONObject state, Callback callback) {
+        stateMap.put(uuid, state);
+        executorService.execute(() -> {
+            try {
+                Thread.sleep(1000);
+                callback.successCallback(channel, "OK");
+            } catch (Exception e) {
+            }
+        });
+    }
+
+    @Override
+    public void getState(String channel, String uuid, Callback callback) {
+        JSONObject jsonObject = stateMap.get(uuid);
+        executorService.execute(() -> {
+            try {
+                Thread.sleep(1000);
+                callback.successCallback(channel, jsonObject);
+            } catch (Exception e) {
+            }
+        });
+    }
+
+    @Override
+    public void hereNow(String channel, boolean state, boolean uuids, Callback callback) {
+
+        executorService.execute(() -> {
+            try {
+                Thread.sleep(500);
+                //@formatter:off
+                JSONObject response = new JSONObject("{\"uuids\":[\"76c2c571-9a2b-d074-b4f8-e93e09f49bd\"," 
+                                                    + "\"175c2c67-b2a9-470d-8f4b-1db94f90e39e\", "
+                                                    + "\"2c67175c-2a9b-074d-4b8f-90e39e1db94f\"]," 
+                                                    + "\"occupancy\":3 }");
+                //@formatter:on
+                callback.successCallback(channel, response);
+            } catch (Exception e) {
+            }
+
+        });
+    }
+
+    @Override
+    public void whereNow(String uuid, Callback callback) {
+        executorService.execute(() -> {
+            try {
+                Thread.sleep(1000);
+                callback.successCallback("channel", new JSONObject("{\"channels\":[\"hello_world\"]}"));
+            } catch (Exception e) {
+            }
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
new file mode 100644
index 0000000..c918009
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubOperationsTest.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.Test;
+
+public class PubNubOperationsTest extends CamelTestSupport {
+
+    @Test
+    public void testWhereNow() throws Exception {
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put(PubNubConstants.OPERATION, "WHERE_NOW");
+        headers.put(PubNubConstants.UUID, "uuid");
+        JSONObject response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONObject.class);
+        assertNotNull(response);
+        assertEquals("hello_world", response.getJSONArray("channels").getString(0));
+    }
+
+    @Test
+    public void testHereNow() throws Exception {
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put(PubNubConstants.OPERATION, "HERE_NOW");
+        JSONObject response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONObject.class);
+        assertNotNull(response);
+        assertEquals(3, response.getInt("occupancy"));
+    }
+
+    @Test
+    public void testGetHistory() throws Exception {
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put(PubNubConstants.OPERATION, "GET_HISTORY");
+        JSONArray response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONArray.class);
+        assertNotNull(response);
+        assertEquals("message1", response.getJSONArray(0).getString(0));
+    }
+
+    @Test
+    public void testSetAndGetState() throws Exception {
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put(PubNubConstants.OPERATION, "SET_STATE");
+        headers.put(PubNubConstants.UUID, "myuuid");
+        JSONObject state = new JSONObject("{\"state\":\"active\", \"lat\":\"55.645499\", \"lon\":\"12.370967\"}");
+        template.sendBodyAndHeaders("direct:publish", state, headers);
+        headers.replace(PubNubConstants.OPERATION, "GET_STATE");
+        JSONObject response = template.requestBodyAndHeaders("direct:publish", null, headers, JSONObject.class);
+        assertNotNull(response);
+        assertEquals(state, response);
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
+        return registry;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                //@formatter:off
+                from("direct:publish").to("pubnub://pubsub:mychannel?uuid=myuuid&pubnub=#pubnub")
+                .to("log:io.rhiot.component.pubnub?showAll=true&multiline=true")
+                .to("mock:result");
+                //@formatter:on
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
new file mode 100644
index 0000000..b794537
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/PubNubPresensTest.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub;
+
+import com.pubnub.api.Callback;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.json.JSONObject;
+import org.junit.Test;
+
+public class PubNubPresensTest extends CamelTestSupport {
+    boolean connected;
+    private PubNubMock pubnubMock = new PubNubMock("foo", "bar");
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockResult;
+
+    @Test
+    public void testPresens() throws Exception {
+        mockResult.expectedMessageCount(1);
+        mockResult.expectedHeaderReceived(PubNubConstants.CHANNEL, "mychannel");
+        pubnubMock.subscribe("mychannel", new Callback() {
+            @Override
+            public void connectCallback(String channel, Object message) {
+                connected = true;
+            }
+        });
+        assertMockEndpointsSatisfied();
+        assertTrue(connected);
+        JSONObject presenceResponse = mockResult.getReceivedExchanges().get(0).getIn().getBody(JSONObject.class);
+        assertEquals("join", presenceResponse.getString("action"));
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("pubnub", new PubNubMock("dummy", "dummy"));
+        return registry;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                //@formatter:off
+                from("pubnub://presence:mychannel?pubnub=#pubnub")
+                    .to("log:org.apache.camel.component.pubnub?showAll=true&multiline=true")
+                    .to("mock:result");
+                //@formatter:on
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
new file mode 100644
index 0000000..f24c917
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubExampleConstants.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub.example;
+
+public interface PubNubExampleConstants {
+    // replace subscriber+publisher key with one obtained from PubNub.
+    // http://www.pubnub.com
+    String PUBNUB_SUBSCRIBER_KEY = "mysubkey";
+    String PUBNUB_PUBLISHER_KEY = "mypubkey";
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java
new file mode 100644
index 0000000..10db410
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubOperationsExample.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub.example;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.main.Main;
+import org.json.JSONObject;
+
+//@formatter:off
+/**
+ * Just a small http server hack to try out pubnub method calls. 
+ * HERE_NOW, WHERE_NOW, GET_STATE, SET_STATE, GET_HISTORY, PUBLISH; 
+ * usage : 
+ * do a GET with http param CamelPubNubOperation=METHOD_TO_ACTIVATE eg. HERE_NOW 
+ * 
+ * SET_STATE requires a http param 'body' with some json that is used as pubnub state object. 
+ * Can be any valid json string.
+ *
+ */
+//@formatter:on
+public final class PubNubOperationsExample {
+
+    private PubNubOperationsExample() {
+    }
+
+    public static void main(String[] args) throws Exception {
+        Main main = new Main();
+        main.addRouteBuilder(new RestRoute());
+        main.run();
+    }
+
+    static class RestRoute extends RouteBuilder {
+        private String pubnub = "pubnub://pubsub:iot?publisherKey=" + PubNubExampleConstants.PUBNUB_PUBLISHER_KEY + "&subscriberKey="
+                                + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY;
+
+        @Override
+        public void configure() throws Exception {
+            //@formatter:off
+            from("netty-http:http://0.0.0.0:8080?urlDecodeHeaders=true")
+                .setBody(simple("${header.body}"))
+                .convertBodyTo(JSONObject.class)
+                .to(pubnub);
+            //@formatter:on
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
new file mode 100644
index 0000000..2122bf0
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubPresenseExample.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pubnub.example;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.main.Main;
+
+public final class PubNubPresenseExample {
+
+    private PubNubPresenseExample() {
+    }
+
+    public static void main(String[] args) throws Exception {
+        Main main = new Main();
+        main.addRouteBuilder(new PresensRoute());
+        main.run();
+    }
+
+    static class PresensRoute extends RouteBuilder {
+        @Override
+        public void configure() throws Exception {
+            //@formatter:off
+            from("pubnub://presence:iot?subscriberKey=" + PubNubExampleConstants.PUBNUB_SUBSCRIBER_KEY)
+                .log("${body}")
+                .to("mock:result");
+            //@formatter:on
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/289a6728/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html
----------------------------------------------------------------------
diff --git a/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html
new file mode 100644
index 0000000..9794b0b
--- /dev/null
+++ b/components/camel-pubnub/src/test/java/org/apache/camel/component/pubnub/example/PubNubSensor2Example.html
@@ -0,0 +1,87 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<html>
+  <head>
+
+    <link rel="stylesheet" type="text/css" href="http://pubnub.github.io/eon/lib/eon.css">
+    <script src="http://cdn.pubnub.com/pubnub-3.7.1.min.js"></script>
+    <script src="http://pubnub.github.io/eon/lib/eon-chart.js"></script>
+
+
+    <style>
+      .c3-region-1 {
+        fill: #dd3333;
+        fill-opacity: 0.8
+      }
+    </style>
+
+  </head>
+  <body>
+  	<div>
+  		<div align="center">
+  		<h1>Description</h1>
+  		</div>
+  		<br/>
+  		This is a example of PubNub EON charts displaying stream data using the camel-pubnub component.
+  		<br/>
+  		To see live data you have to:
+  		<ul>
+  			<li>Sign up for a PubNub acount</li>
+  			<li>Replace the 'subscribe_key' in this html.</li>
+  			<li>Update the constants PUBNUB_SUBSCRIBER_KEY and PUBNUB_PUBLISHER_KEY in the class PubNubExampleConstants</li>
+  			<li>Run the class PubNubSensor2Example</li>
+  			
+  		</ul>
+  	</div>
+    <div id="chart"></div>
+    <script>
+
+    var pubnub = PUBNUB.init({
+		subscribe_key: 'mysubscriberkey'
+	});
+    eon.chart({
+    	pubnub: pubnub,
+    	history: false,
+	    channel: 'iot',
+    	flow: true,
+    	generate: {
+    	    bindto: '#chart',
+    	    data: {
+				x: 'x',
+				labels: true
+    	    },
+    	    axis: {
+    	      	x: {
+	    	        type: 'timeseries',
+	    	        tick: {
+	    	            format: '%Y-%m-%d'
+	    	        }
+    	      	}
+    	    }
+    	},
+	    transform: function(m) {
+	    	var response = {columns: [
+	    		['x', new Date().getTime()],
+	    		['Humidity', m.humidity],
+	    		['Temperature', m.temperature]
+	    	]};
+	    	return response;
+	    }
+	});
+    </script>
+  </body>
+</html>
\ No newline at end of file