This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 099a2e9ec40 CAMEL-19005: Upgrade to 6.3.1
099a2e9ec40 is described below
commit 099a2e9ec40fd9d9e684feaab245037b901d30b3
Author: Croway <[email protected]>
AuthorDate: Fri Feb 3 12:50:31 2023 +0100
CAMEL-19005: Upgrade to 6.3.1
---
camel-dependencies/pom.xml | 2 +-
components/camel-pubnub/pom.xml | 16 +++-----
.../org/apache/camel/component/pubnub/pubnub.json | 4 +-
.../component/pubnub/PubNubConfiguration.java | 1 +
.../camel/component/pubnub/PubNubConsumer.java | 43 ++++++++++++++++++++++
.../camel/component/pubnub/PubNubEndpoint.java | 11 +++---
.../camel/component/pubnub/PubNubTestBase.java | 10 ++++-
.../pubnub/example/PubNubGeoLocationExample.java | 14 ++-----
.../pubnub/example/PubNubPresenseExample.java | 2 +-
.../pubnub/example/PubNubSensor2Example.java | 26 ++-----------
.../pubnub/example/PubNubSensorExample.java | 4 +-
parent/pom.xml | 2 +-
12 files changed, 79 insertions(+), 56 deletions(-)
diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml
index d8eee4b4f36..7348934a7c3 100644
--- a/camel-dependencies/pom.xml
+++ b/camel-dependencies/pom.xml
@@ -426,7 +426,7 @@
<protonpack-version>1.8</protonpack-version>
<protostream-version>4.5.0.Final</protostream-version>
<prowide-version>SRU2022-9.3.2</prowide-version>
- <pubnub-version>4.25.0</pubnub-version>
+ <pubnub-version>6.3.1</pubnub-version>
<pulsar-version>2.11.0</pulsar-version>
<qpid-broker-version>9.0.0</qpid-broker-version>
<qpid-proton-j-version>0.34.0</qpid-proton-j-version>
diff --git a/components/camel-pubnub/pom.xml b/components/camel-pubnub/pom.xml
index df25b6eb9d9..b97c067ce99 100644
--- a/components/camel-pubnub/pom.xml
+++ b/components/camel-pubnub/pom.xml
@@ -45,16 +45,12 @@
<groupId>com.pubnub</groupId>
<artifactId>pubnub-gson</artifactId>
<version>${pubnub-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>okhttp</artifactId>
- <version>${squareup-okhttp-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okio</groupId>
- <artifactId>okio</artifactId>
- <version>${squareup-okio-version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
diff --git
a/components/camel-pubnub/src/generated/resources/org/apache/camel/component/pubnub/pubnub.json
b/components/camel-pubnub/src/generated/resources/org/apache/camel/component/pubnub/pubnub.json
index ab071bf687a..b2357991688 100644
---
a/components/camel-pubnub/src/generated/resources/org/apache/camel/component/pubnub/pubnub.json
+++
b/components/camel-pubnub/src/generated/resources/org/apache/camel/component/pubnub/pubnub.json
@@ -23,7 +23,7 @@
},
"componentProperties": {
"configuration": { "kind": "property", "displayName": "Configuration",
"group": "common", "label": "", "required": false, "type": "object",
"javaType": "org.apache.camel.component.pubnub.PubNubConfiguration",
"deprecated": false, "autowired": false, "secret": false, "description": "The
component configurations" },
- "uuid": { "kind": "property", "displayName": "Uuid", "group": "common",
"label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.pubnub.PubNubConfiguration",
"configurationField": "configuration", "description": "UUID to be used as a
device identifier, a default UUID is generated if not passed." },
+ "uuid": { "kind": "property", "displayName": "Uuid", "group": "common",
"label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.pubnub.PubNubConfiguration", "configurationField":
"configuration", "description": "UUID to be used as a device identifier, a
default UUID is generated if not passed." },
"bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error
Handler", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "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 me [...]
"withPresence": { "kind": "property", "displayName": "With Presence",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.pubnub.PubNubConfiguration", "configurationField":
"configuration", "description": "Also subscribe to related presence
information" },
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during star [...]
@@ -44,7 +44,7 @@
},
"properties": {
"channel": { "kind": "path", "displayName": "Channel", "group": "common",
"label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.pubnub.PubNubConfiguration", "configurationField":
"configuration", "description": "The channel used for subscribing\/publishing
events" },
- "uuid": { "kind": "parameter", "displayName": "Uuid", "group": "common",
"label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.pubnub.PubNubConfiguration",
"configurationField": "configuration", "description": "UUID to be used as a
device identifier, a default UUID is generated if not passed." },
+ "uuid": { "kind": "parameter", "displayName": "Uuid", "group": "common",
"label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.pubnub.PubNubConfiguration", "configurationField":
"configuration", "description": "UUID to be used as a device identifier, a
default UUID is generated if not passed." },
"withPresence": { "kind": "parameter", "displayName": "With Presence",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.pubnub.PubNubConfiguration", "configurationField":
"configuration", "description": "Also subscribe to related presence
information" },
"bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "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 [...]
"exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By default the
con [...]
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 7e5b4025fed..a5a34046801 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
@@ -41,6 +41,7 @@ public class PubNubConfiguration implements Cloneable {
@UriParam(label = "security", defaultValue = "true")
private boolean secure = true;
@UriParam
+ @Metadata(required = true)
private String uuid;
@UriParam(label = "producer", enums =
"HERENOW,WHERENOW,GETSTATE,SETSTATE,GETHISTORY,PUBLISH,FIRE")
private String operation;
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 6e2035eef69..bbd17fe994c 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
@@ -21,12 +21,19 @@ 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.objects_api.channel.PNChannelMetadataResult;
+import
com.pubnub.api.models.consumer.objects_api.membership.PNMembershipResult;
+import com.pubnub.api.models.consumer.objects_api.uuid.PNUUIDMetadataResult;
import com.pubnub.api.models.consumer.pubsub.PNMessageResult;
import com.pubnub.api.models.consumer.pubsub.PNPresenceEventResult;
+import com.pubnub.api.models.consumer.pubsub.PNSignalResult;
+import com.pubnub.api.models.consumer.pubsub.files.PNFileEventResult;
+import
com.pubnub.api.models.consumer.pubsub.message_actions.PNMessageActionResult;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.support.DefaultConsumer;
+import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -131,6 +138,42 @@ public class PubNubConsumer extends DefaultConsumer {
}
}
+ /**
+ * signal, user, space, membership, messageAction, presence, and file
listeners are mandatory and you MUST at
+ * least provide no op implementations for these listeners
+ *
+ * @param pubnub
+ * @param pnSignalResult
+ */
+ @Override
+ public void signal(@NotNull PubNub pubnub, @NotNull PNSignalResult
pnSignalResult) {
+ LOG.trace("signal: {}.", pnSignalResult);
+ }
+
+ @Override
+ public void uuid(@NotNull PubNub pubnub, @NotNull PNUUIDMetadataResult
pnUUIDMetadataResult) {
+ LOG.trace("uuid: {}.", pnUUIDMetadataResult);
+ }
+
+ @Override
+ public void channel(@NotNull PubNub pubnub, @NotNull
PNChannelMetadataResult pnChannelMetadataResult) {
+ LOG.trace("uuid: {}.", pnChannelMetadataResult);
+ }
+
+ @Override
+ public void membership(@NotNull PubNub pubnub, @NotNull
PNMembershipResult pnMembershipResult) {
+ LOG.trace("membership: {}.", pnMembershipResult);
+ }
+
+ @Override
+ public void messageAction(@NotNull PubNub pubnub, @NotNull
PNMessageActionResult pnMessageActionResult) {
+ LOG.trace("messageAction: {}.", pnMessageActionResult);
+ }
+
+ @Override
+ public void file(@NotNull PubNub pubnub, @NotNull PNFileEventResult
pnFileEventResult) {
+ LOG.trace("file: {}.", pnFileEventResult);
+ }
}
}
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 8912e0da27f..feecd6aea92 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
@@ -18,6 +18,8 @@ package org.apache.camel.component.pubnub;
import com.pubnub.api.PNConfiguration;
import com.pubnub.api.PubNub;
+import com.pubnub.api.PubNubException;
+import com.pubnub.api.UserId;
import org.apache.camel.Category;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
@@ -26,7 +28,6 @@ import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.support.DefaultEndpoint;
-import org.apache.camel.util.ObjectHelper;
/**
* Send and receive messages to/from PubNub data stream network for connected
devices.
@@ -87,18 +88,16 @@ public class PubNubEndpoint extends DefaultEndpoint {
super.doStart();
}
- private PubNub getInstance() {
+ private PubNub getInstance() throws PubNubException {
PubNub answer = null;
- PNConfiguration pnConfiguration = new PNConfiguration();
+ PNConfiguration pnConfiguration = new PNConfiguration(new
UserId(configuration.getUuid()));
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());
- }
+
answer = new PubNub(pnConfiguration);
return answer;
}
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
index 469621f89d0..d9861e06f42 100644
---
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
@@ -20,6 +20,8 @@ import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.pubnub.api.PNConfiguration;
import com.pubnub.api.PubNub;
+import com.pubnub.api.PubNubException;
+import com.pubnub.api.UserId;
import com.pubnub.api.enums.PNLogVerbosity;
import org.apache.camel.BindToRegistry;
import org.apache.camel.test.AvailablePortFinder;
@@ -52,13 +54,17 @@ public class PubNubTestBase extends CamelTestSupport {
}
private PubNub createPubNubInstance() {
- PNConfiguration pnConfiguration = new PNConfiguration();
+ PNConfiguration pnConfiguration = null;
+ try {
+ pnConfiguration = new PNConfiguration(new UserId("myUUID"));
+ } catch (PubNubException e) {
+ throw new RuntimeException(e);
+ }
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 {
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 ed4c767210a..1164c86f6d9 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
@@ -42,21 +42,15 @@ public final class PubNubGeoLocationExample {
public void configure() {
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="
+
.to("pubnub:eon-maps-geolocation-input?uuid=camel&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?uuid=camel&subscribeKey="
+ PUBNUB_SUBSCRIBE_KEY)
.log("${body}");
}
}
- static class Foo {
- String foo;
- String text;
-
- Foo(String foo, String text) {
- this.foo = foo;
- this.text = text;
- }
+ record Foo(String foo, String text) {
}
}
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 cda1d0ccfc2..f0782898338 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() {
- from("pubnub:iot?withPresence=true&subscribeKey=" +
PUBNUB_SUBSCRIBE_KEY)
+ from("pubnub:iot?uuid=camel&withPresence=true&subscribeKey=" +
PUBNUB_SUBSCRIBE_KEY)
.log("${body}")
.to("mock:result");
}
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 4825efb0100..2d29012d4a7 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
@@ -107,30 +107,12 @@ public final class PubNubSensor2Example {
}
}
- static class DeviceWeatherInfo {
- private String device;
- private int humidity;
- private int temperature;
-
- DeviceWeatherInfo(String device) {
- SecureRandom rand = new SecureRandom();
- this.device = device;
- this.humidity = rand.nextInt(100);
- this.temperature = rand.nextInt(40);
- }
-
- public String getDevice() {
- return device;
- }
+ record DeviceWeatherInfo(String device, int humidity, int temperature) {
- public int getHumidity() {
- return humidity;
+ private static SecureRandom rand = new SecureRandom();
+ public DeviceWeatherInfo(String device) {
+ this(device, rand.nextInt(100), rand.nextInt(40));
}
-
- public int getTemperature() {
- return temperature;
- }
-
}
public static class EventGeneratorBean {
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 d65210966e7..8b3fe0f73d7 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
@@ -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_SUBSCRIBE_KEY;
+
public final class PubNubSensorExample {
private PubNubSensorExample() {
@@ -33,7 +35,7 @@ public final class PubNubSensorExample {
static class SensorRoute extends RouteBuilder {
@Override
public void configure() {
-
from("pubnub:pubnub-sensor-network?subscribeKey=sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe").log("${body}")
+ from("pubnub:pubnub-sensor-network?uuid=camel&subscribeKey=" +
PUBNUB_SUBSCRIBE_KEY).log("${body}")
.to("mock:result");
}
}
diff --git a/parent/pom.xml b/parent/pom.xml
index 5957a45b419..4114239c831 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -421,7 +421,7 @@
<protonpack-version>1.8</protonpack-version>
<protostream-version>4.5.0.Final</protostream-version>
<prowide-version>SRU2022-9.3.2</prowide-version>
- <pubnub-version>4.25.0</pubnub-version>
+ <pubnub-version>6.3.1</pubnub-version>
<pulsar-version>2.11.0</pulsar-version>
<qpid-broker-version>9.0.0</qpid-broker-version>
<qpid-proton-j-version>0.34.0</qpid-proton-j-version>