This is an automated email from the ASF dual-hosted git repository.
mytang0 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 2f0523051 [ISSUE #3545]Rename StorageConnectorRuntimeException to
StorageRuntimeException
new 5c5f155e2 Merge pull request #3546 from mxsm/eventmesh-3545
2f0523051 is described below
commit 2f052305147ff05860d6d5d85fbd26946509af4a
Author: mxsm <[email protected]>
AuthorDate: Tue Mar 28 22:32:51 2023 +0800
[ISSUE #3545]Rename StorageConnectorRuntimeException to
StorageRuntimeException
---
.../api/exception/OnExceptionContext.java | 2 +-
...Exception.java => StorageRuntimeException.java} | 10 +++++-----
.../storage/kafka/consumer/ConsumerImpl.java | 8 ++++----
.../storage/kafka/producer/ProducerImpl.java | 12 ++++++------
.../mongodb/exception/MongodbStorageException.java | 4 ++--
.../storage/pravega/PravegaProducerImpl.java | 4 ++--
.../pravega/exception/PravegaStorageException.java | 4 ++--
.../storage/pulsar/client/PulsarClientWrapper.java | 6 +++---
.../pulsar/consumer/PulsarConsumerImpl.java | 14 +++++++-------
.../storage/pulsar/producer/AbstractProducer.java | 8 ++++----
.../pulsar/producer/PulsarProducerImpl.java | 12 ++++++------
.../exception/RabbitmqStorageException.java | 4 ++--
.../rabbitmq/producer/RabbitmqProducer.java | 4 ++--
.../storage/redis/client/RedissonClient.java | 6 +++---
.../storage/redis/producer/RedisProducer.java | 10 +++++-----
.../rocketmq/consumer/PushConsumerImpl.java | 16 ++++++++--------
.../exception/RMQMessageFormatException.java | 4 ++--
.../rocketmq/exception/RMQTimeoutException.java | 4 ++--
.../rocketmq/producer/AbstractProducer.java | 22 +++++++++++-----------
.../storage/rocketmq/producer/ProducerImpl.java | 6 +++---
.../rocketmq/producer/ProducerImplTest.java | 4 ++--
.../standalone/producer/StandaloneProducer.java | 14 +++++++-------
22 files changed, 89 insertions(+), 89 deletions(-)
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/OnExceptionContext.java
b/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/OnExceptionContext.java
index 0dea563ee..f4d948830 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/OnExceptionContext.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/OnExceptionContext.java
@@ -35,5 +35,5 @@ public class OnExceptionContext {
/**
* Detailed exception stack information.
*/
- private StorageConnectorRuntimeException exception;
+ private StorageRuntimeException exception;
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/StorageConnectorRuntimeException.java
b/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/StorageRuntimeException.java
similarity index 74%
rename from
eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/StorageConnectorRuntimeException.java
rename to
eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/StorageRuntimeException.java
index a77369eb8..db2728897 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/StorageConnectorRuntimeException.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-api/src/main/java/org/apache/eventmesh/api/exception/StorageRuntimeException.java
@@ -17,21 +17,21 @@
package org.apache.eventmesh.api.exception;
-public class StorageConnectorRuntimeException extends RuntimeException {
+public class StorageRuntimeException extends RuntimeException {
- public StorageConnectorRuntimeException() {
+ public StorageRuntimeException() {
}
- public StorageConnectorRuntimeException(String message) {
+ public StorageRuntimeException(String message) {
super(message);
}
- public StorageConnectorRuntimeException(Throwable throwable) {
+ public StorageRuntimeException(Throwable throwable) {
super(throwable);
}
- public StorageConnectorRuntimeException(String message, Throwable
throwable) {
+ public StorageRuntimeException(String message, Throwable throwable) {
super(message, throwable);
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/consumer/ConsumerImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/consumer/ConsumerImpl.java
index 92a5b86ec..795b9089b 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/consumer/ConsumerImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/consumer/ConsumerImpl.java
@@ -19,7 +19,7 @@ package org.apache.eventmesh.storage.kafka.consumer;
import org.apache.eventmesh.api.AbstractContext;
import org.apache.eventmesh.api.EventListener;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.KafkaConsumer;
@@ -56,7 +56,7 @@ public class ConsumerImpl {
// Setting the ClassLoader to null is necessary for Kafka consumer
configuration
final ClassLoader original =
Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(null);
-
+
Properties props = new Properties();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
properties.getProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG));
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
StringDeserializer.class);
@@ -114,7 +114,7 @@ public class ConsumerImpl {
this.kafkaConsumer.subscribe(topics);
} catch (Exception e) {
log.error("Error while subscribing the Kafka consumer to topic: ",
e);
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Kafka consumer can't attach to %s.", topic));
}
}
@@ -128,7 +128,7 @@ public class ConsumerImpl {
this.kafkaConsumer.subscribe(topics);
} catch (Exception e) {
log.error("Error while unsubscribing the Kafka consumer: ", e);
- throw new StorageConnectorRuntimeException(String.format("kafka
push consumer fails to unsubscribe topic: %s", topic));
+ throw new StorageRuntimeException(String.format("kafka push
consumer fails to unsubscribe topic: %s", topic));
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/producer/ProducerImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/producer/ProducerImpl.java
index d72d6883c..643ff3d91 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/producer/ProducerImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/producer/ProducerImpl.java
@@ -21,7 +21,7 @@ import org.apache.eventmesh.api.RequestReplyCallback;
import org.apache.eventmesh.api.SendCallback;
import org.apache.eventmesh.api.SendResult;
import org.apache.eventmesh.api.exception.OnExceptionContext;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.kafka.clients.admin.Admin;
@@ -85,22 +85,22 @@ public class ProducerImpl {
}
}
- public void checkTopicExist(String topic) throws ExecutionException,
InterruptedException, StorageConnectorRuntimeException {
+ public void checkTopicExist(String topic) throws ExecutionException,
InterruptedException, StorageRuntimeException {
try(Admin admin = Admin.create(properties)){
Set<String> topicNames = admin.listTopics().names().get();
boolean exist = topicNames.contains(topic);
if (!exist) {
- throw new
StorageConnectorRuntimeException(String.format("topic:%s is not exist", topic));
+ throw new StorageRuntimeException(String.format("topic:%s is
not exist", topic));
}
}
}
public void request(CloudEvent cloudEvent, RequestReplyCallback
rrCallback, long timeout) throws Exception {
- throw new StorageConnectorRuntimeException("Request is not supported");
+ throw new StorageRuntimeException("Request is not supported");
}
public boolean reply(CloudEvent cloudEvent, SendCallback sendCallback)
throws Exception {
- throw new StorageConnectorRuntimeException("Reply is not supported");
+ throw new StorageRuntimeException("Reply is not supported");
}
public void sendOneway(CloudEvent message) {
@@ -110,7 +110,7 @@ public class ProducerImpl {
try {
this.producer.send(new ProducerRecord<>(cloudEvent.getSubject(),
cloudEvent), (metadata, exception) -> {
if (exception != null) {
- StorageConnectorRuntimeException onsEx = new
StorageConnectorRuntimeException(exception.getMessage(), exception);
+ StorageRuntimeException onsEx = new
StorageRuntimeException(exception.getMessage(), exception);
OnExceptionContext context = new OnExceptionContext();
context.setTopic(cloudEvent.getSubject());
context.setException(onsEx);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/exception/MongodbStorageException.java
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/exception/MongodbStorageException.java
index bc5607c81..e9dfe6794 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/exception/MongodbStorageException.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/exception/MongodbStorageException.java
@@ -17,9 +17,9 @@
package org.apache.eventmesh.storage.mongodb.exception;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
-public class MongodbStorageException extends StorageConnectorRuntimeException {
+public class MongodbStorageException extends StorageRuntimeException {
public MongodbStorageException(String message) {
super(message);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaProducerImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaProducerImpl.java
index 03eef5b4e..707858d50 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaProducerImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaProducerImpl.java
@@ -21,7 +21,7 @@ import org.apache.eventmesh.api.RequestReplyCallback;
import org.apache.eventmesh.api.SendCallback;
import org.apache.eventmesh.api.SendResult;
import org.apache.eventmesh.api.exception.OnExceptionContext;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.api.producer.Producer;
import org.apache.eventmesh.common.config.Config;
import org.apache.eventmesh.storage.pravega.client.PravegaClient;
@@ -82,7 +82,7 @@ public class PravegaProducerImpl implements Producer {
OnExceptionContext onExceptionContext =
OnExceptionContext.builder()
.messageId("-1")
.topic(cloudEvent.getSubject())
- .exception(new StorageConnectorRuntimeException(e))
+ .exception(new StorageRuntimeException(e))
.build();
sendCallback.onException(onExceptionContext);
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/exception/PravegaStorageException.java
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/exception/PravegaStorageException.java
index 85cfa710e..50d23cbba 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/exception/PravegaStorageException.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/exception/PravegaStorageException.java
@@ -17,9 +17,9 @@
package org.apache.eventmesh.storage.pravega.exception;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
-public class PravegaStorageException extends StorageConnectorRuntimeException {
+public class PravegaStorageException extends StorageRuntimeException {
public PravegaStorageException(String message) {
super(message);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/client/PulsarClientWrapper.java
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/client/PulsarClientWrapper.java
index 9ad3f95ae..0dc2ce12e 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/client/PulsarClientWrapper.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/client/PulsarClientWrapper.java
@@ -18,7 +18,7 @@
package org.apache.eventmesh.storage.pulsar.client;
import org.apache.eventmesh.api.SendCallback;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.storage.pulsar.config.ClientConfiguration;
import org.apache.eventmesh.storage.pulsar.utils.CloudEventUtils;
@@ -73,7 +73,7 @@ public class PulsarClientWrapper {
this.pulsarClient = clientBuilder.build();
} catch (PulsarClientException ex) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Failed to connect pulsar cluster %s with
exception: %s", config.getServiceAddr(), ex.getMessage()));
}
}
@@ -87,7 +87,7 @@ public class PulsarClientWrapper {
.blockIfQueueFull(true)
.create();
} catch (PulsarClientException ex) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Failed to create pulsar producer for %s with
exception: %s", topic, ex.getMessage()));
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/consumer/PulsarConsumerImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/consumer/PulsarConsumerImpl.java
index bafd63745..9601dd8a4 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/consumer/PulsarConsumerImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/consumer/PulsarConsumerImpl.java
@@ -22,7 +22,7 @@ import org.apache.eventmesh.api.EventListener;
import org.apache.eventmesh.api.EventMeshAction;
import org.apache.eventmesh.api.EventMeshAsyncConsumeContext;
import org.apache.eventmesh.api.consumer.Consumer;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.config.Config;
import org.apache.eventmesh.storage.pulsar.config.ClientConfiguration;
@@ -93,7 +93,7 @@ public class PulsarConsumerImpl implements Consumer {
this.pulsarClient = clientBuilder.build();
} catch (Exception ex) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Failed to connect pulsar with exception: %s",
ex.getMessage()));
}
}
@@ -107,7 +107,7 @@ public class PulsarConsumerImpl implements Consumer {
public void subscribe(String topic) throws Exception {
String subTopic = clientConfiguration.getTopicPrefix() + topic;
if (pulsarClient == null) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Cann't find the pulsar client for topic: %s",
subTopic));
}
@@ -137,7 +137,7 @@ public class PulsarConsumerImpl implements Consumer {
try {
ackConsumer.acknowledge(msg);
} catch (PulsarClientException ex) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Failed to unsubscribe the topic:%s
with exception: %s", subTopic, ex.getMessage()));
} catch (EventDeserializationException ex) {
log.warn("The Message isn't json format, with
exception:{}", ex.getMessage());
@@ -157,7 +157,7 @@ public class PulsarConsumerImpl implements Consumer {
consumer.unsubscribe();
consumerMap.remove(consumerKey);
} catch (PulsarClientException ex) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Failed to unsubscribe the topic:%s with
exception: %s", topic, ex.getMessage()));
}
}
@@ -190,14 +190,14 @@ public class PulsarConsumerImpl implements Consumer {
try {
consumer.close();
} catch (PulsarClientException e) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Failed to close the pulsar consumer
with exception: %s", e.getMessage()));
}
});
this.pulsarClient.close();
consumerMap.clear();
} catch (PulsarClientException ex) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Failed to close the pulsar client with
exception: %s", ex.getMessage()));
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/AbstractProducer.java
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/AbstractProducer.java
index 4137f8620..2f3aa126d 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/AbstractProducer.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/AbstractProducer.java
@@ -17,7 +17,7 @@
package org.apache.eventmesh.storage.pulsar.producer;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -38,11 +38,11 @@ public abstract class AbstractProducer {
return this.properties;
}
- StorageConnectorRuntimeException checkProducerException(CloudEvent
cloudEvent, Throwable e) {
+ StorageRuntimeException checkProducerException(CloudEvent cloudEvent,
Throwable e) {
if (cloudEvent.getData() == null) {
- return new
StorageConnectorRuntimeException(String.format("CloudEvent message data does
not exist, %s", e.getMessage()));
+ return new StorageRuntimeException(String.format("CloudEvent
message data does not exist, %s", e.getMessage()));
}
- return new StorageConnectorRuntimeException(String.format("Unknown
connector runtime exception, %s", e.getMessage()));
+ return new StorageRuntimeException(String.format("Unknown connector
runtime exception, %s", e.getMessage()));
}
public boolean isStarted() {
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/PulsarProducerImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/PulsarProducerImpl.java
index 11dfbc3f2..781700d96 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/PulsarProducerImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/producer/PulsarProducerImpl.java
@@ -19,7 +19,7 @@ package org.apache.eventmesh.storage.pulsar.producer;
import org.apache.eventmesh.api.RequestReplyCallback;
import org.apache.eventmesh.api.SendCallback;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.api.producer.Producer;
import org.apache.eventmesh.common.config.Config;
import org.apache.eventmesh.storage.pulsar.config.ClientConfiguration;
@@ -70,27 +70,27 @@ public class PulsarProducerImpl implements Producer {
@Override
public void sendOneway(CloudEvent cloudEvent) {
- throw new StorageConnectorRuntimeException("SendOneWay is not
supported");
+ throw new StorageRuntimeException("SendOneWay is not supported");
}
@Override
public void request(CloudEvent cloudEvent, RequestReplyCallback
rrCallback, long timeout) throws Exception {
- throw new StorageConnectorRuntimeException("Request is not supported");
+ throw new StorageRuntimeException("Request is not supported");
}
@Override
public boolean reply(CloudEvent cloudEvent, SendCallback sendCallback)
throws Exception {
- throw new StorageConnectorRuntimeException("Reply is not supported");
+ throw new StorageRuntimeException("Reply is not supported");
}
@Override
public void checkTopicExist(String topic) throws Exception {
- throw new StorageConnectorRuntimeException("CheckTopicExist is not
supported");
+ throw new StorageRuntimeException("CheckTopicExist is not supported");
}
@Override
public void setExtFields() {
- throw new StorageConnectorRuntimeException("SetExtFields is not
supported");
+ throw new StorageRuntimeException("SetExtFields is not supported");
}
public ClientConfiguration getClientConfiguration() {
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/exception/RabbitmqStorageException.java
b/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/exception/RabbitmqStorageException.java
index 80d210957..f694ab093 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/exception/RabbitmqStorageException.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/exception/RabbitmqStorageException.java
@@ -17,9 +17,9 @@
package org.apache.eventmesh.storage.rabbitmq.exception;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
-public class RabbitmqStorageException extends StorageConnectorRuntimeException
{
+public class RabbitmqStorageException extends StorageRuntimeException {
public RabbitmqStorageException(String message) {
super(message);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/producer/RabbitmqProducer.java
b/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/producer/RabbitmqProducer.java
index 01fc96af4..9a4e0dbd8 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/producer/RabbitmqProducer.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/producer/RabbitmqProducer.java
@@ -21,7 +21,7 @@ import org.apache.eventmesh.api.RequestReplyCallback;
import org.apache.eventmesh.api.SendCallback;
import org.apache.eventmesh.api.SendResult;
import org.apache.eventmesh.api.exception.OnExceptionContext;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.api.producer.Producer;
import org.apache.eventmesh.common.config.Config;
import org.apache.eventmesh.storage.rabbitmq.client.RabbitmqClient;
@@ -117,7 +117,7 @@ public class RabbitmqProducer implements Producer {
OnExceptionContext.builder()
.topic(cloudEvent.getSubject())
.messageId(cloudEvent.getId())
- .exception(new StorageConnectorRuntimeException(ex))
+ .exception(new StorageRuntimeException(ex))
.build()
);
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/client/RedissonClient.java
b/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/client/RedissonClient.java
index 43f4181e4..68b661a19 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/client/RedissonClient.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/client/RedissonClient.java
@@ -17,7 +17,7 @@
package org.apache.eventmesh.storage.redis.client;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.config.ConfigService;
import org.apache.eventmesh.storage.redis.cloudevent.CloudEventCodec;
@@ -70,7 +70,7 @@ public final class RedissonClient {
final String message = "Invalid Redis server type: " +
properties.getServerType()
+ ", supported values are: "
+ Arrays.toString(RedisProperties.ServerType.values());
- throw new StorageConnectorRuntimeException(message, ie);
+ throw new StorageRuntimeException(message, ie);
}
String serverAddress = properties.getServerAddress();
@@ -106,7 +106,7 @@ public final class RedissonClient {
final String message = "Invalid Redis server type: " +
properties.getServerType()
+ ", supported values are: "
+ Arrays.toString(RedisProperties.ServerType.values());
- throw new StorageConnectorRuntimeException(message);
+ throw new StorageRuntimeException(message);
}
return (Redisson) Redisson.create(config);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/producer/RedisProducer.java
b/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/producer/RedisProducer.java
index 329307f41..227f89b8f 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/producer/RedisProducer.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-redis/src/main/java/org/apache/eventmesh/storage/redis/producer/RedisProducer.java
@@ -21,7 +21,7 @@ import org.apache.eventmesh.api.RequestReplyCallback;
import org.apache.eventmesh.api.SendCallback;
import org.apache.eventmesh.api.SendResult;
import org.apache.eventmesh.api.exception.OnExceptionContext;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.api.producer.Producer;
import org.apache.eventmesh.storage.redis.client.RedissonClient;
@@ -88,7 +88,7 @@ public class RedisProducer implements Producer {
OnExceptionContext.builder()
.topic(cloudEvent.getSubject())
.messageId(cloudEvent.getId())
- .exception(new
StorageConnectorRuntimeException(throwable))
+ .exception(new StorageRuntimeException(throwable))
.build()
);
} else {
@@ -103,7 +103,7 @@ public class RedisProducer implements Producer {
OnExceptionContext.builder()
.topic(cloudEvent.getSubject())
.messageId(cloudEvent.getId())
- .exception(new StorageConnectorRuntimeException(e))
+ .exception(new StorageRuntimeException(e))
.build()
);
}
@@ -119,12 +119,12 @@ public class RedisProducer implements Producer {
@Override
public void request(CloudEvent cloudEvent, RequestReplyCallback
rrCallback, long timeout) {
- throw new StorageConnectorRuntimeException("Request is not supported");
+ throw new StorageRuntimeException("Request is not supported");
}
@Override
public boolean reply(CloudEvent cloudEvent, SendCallback sendCallback) {
- throw new StorageConnectorRuntimeException("Reply is not supported");
+ throw new StorageRuntimeException("Reply is not supported");
}
@Override
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java
index aa4b6422f..4a4e2d43c 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java
@@ -21,7 +21,7 @@ import org.apache.eventmesh.api.AbstractContext;
import org.apache.eventmesh.api.EventListener;
import org.apache.eventmesh.api.EventMeshAction;
import org.apache.eventmesh.api.EventMeshAsyncConsumeContext;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.storage.rocketmq.cloudevent.RocketMQMessageFactory;
import org.apache.eventmesh.storage.rocketmq.common.EventMeshConstants;
@@ -68,12 +68,12 @@ public class PushConsumerImpl {
String accessPoints = clientConfig.getAccessPoints();
if (accessPoints == null || accessPoints.isEmpty()) {
- throw new StorageConnectorRuntimeException("OMS AccessPoints is
null or empty.");
+ throw new StorageRuntimeException("OMS AccessPoints is null or
empty.");
}
this.rocketmqPushConsumer.setNamesrvAddr(accessPoints.replace(',',
';'));
String consumerGroup = clientConfig.getConsumerId();
if (null == consumerGroup || consumerGroup.isEmpty()) {
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
"Consumer Group is necessary for RocketMQ, please set it.");
}
this.rocketmqPushConsumer.setConsumerGroup(consumerGroup);
@@ -107,7 +107,7 @@ public class PushConsumerImpl {
try {
this.rocketmqPushConsumer.start();
} catch (Exception e) {
- throw new StorageConnectorRuntimeException(e.getMessage());
+ throw new StorageRuntimeException(e.getMessage());
}
}
}
@@ -137,7 +137,7 @@ public class PushConsumerImpl {
try {
this.rocketmqPushConsumer.subscribe(topic, subExpression);
} catch (MQClientException e) {
- throw new StorageConnectorRuntimeException(String.format("RocketMQ
push consumer can't attach to %s.", topic));
+ throw new StorageRuntimeException(String.format("RocketMQ push
consumer can't attach to %s.", topic));
}
}
@@ -145,7 +145,7 @@ public class PushConsumerImpl {
try {
this.rocketmqPushConsumer.unsubscribe(topic);
} catch (Exception e) {
- throw new StorageConnectorRuntimeException(String.format("RocketMQ
push consumer fails to unsubscribe topic: %s", topic));
+ throw new StorageRuntimeException(String.format("RocketMQ push
consumer fails to unsubscribe topic: %s", topic));
}
}
@@ -195,7 +195,7 @@ public class PushConsumerImpl {
}
if (eventListener == null) {
- throw new StorageConnectorRuntimeException(String.format("The
topic/queue %s isn't attached to this consumer",
+ throw new StorageRuntimeException(String.format("The
topic/queue %s isn't attached to this consumer",
msg.getTopic()));
}
@@ -266,7 +266,7 @@ public class PushConsumerImpl {
}
if (eventListener == null) {
- throw new StorageConnectorRuntimeException(String.format("The
topic/queue %s isn't attached to this consumer",
+ throw new StorageRuntimeException(String.format("The
topic/queue %s isn't attached to this consumer",
msg.getTopic()));
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQMessageFormatException.java
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQMessageFormatException.java
index bec8c7383..6257737be 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQMessageFormatException.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQMessageFormatException.java
@@ -17,9 +17,9 @@
package org.apache.eventmesh.storage.rocketmq.exception;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
-public class RMQMessageFormatException extends
StorageConnectorRuntimeException {
+public class RMQMessageFormatException extends StorageRuntimeException {
public RMQMessageFormatException(String message) {
super(message);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQTimeoutException.java
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQTimeoutException.java
index 5c1d1265b..ae82bb3f1 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQTimeoutException.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/exception/RMQTimeoutException.java
@@ -17,9 +17,9 @@
package org.apache.eventmesh.storage.rocketmq.exception;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
-public class RMQTimeoutException extends StorageConnectorRuntimeException {
+public class RMQTimeoutException extends StorageRuntimeException {
public RMQTimeoutException(String message) {
super(message);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/AbstractProducer.java
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/AbstractProducer.java
index 29a5bb4b1..14e783773 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/AbstractProducer.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/AbstractProducer.java
@@ -17,7 +17,7 @@
package org.apache.eventmesh.storage.rocketmq.producer;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.storage.rocketmq.config.ClientConfig;
import
org.apache.eventmesh.storage.rocketmq.exception.RMQMessageFormatException;
@@ -55,7 +55,7 @@ public abstract class AbstractProducer {
String accessPoints = clientConfig.getAccessPoints();
if (accessPoints == null || accessPoints.isEmpty()) {
- throw new StorageConnectorRuntimeException("OMS AccessPoints is
null or empty.");
+ throw new StorageRuntimeException("OMS AccessPoints is null or
empty.");
}
this.rocketmqProducer.setNamesrvAddr(accessPoints.replace(',', ';'));
@@ -75,7 +75,7 @@ public abstract class AbstractProducer {
try {
this.rocketmqProducer.start();
} catch (MQClientException e) {
- throw new StorageConnectorRuntimeException("-1", e);
+ throw new StorageRuntimeException("-1", e);
}
}
this.started.set(true);
@@ -96,7 +96,7 @@ public abstract class AbstractProducer {
return !this.isStarted();
}
- StorageConnectorRuntimeException checkProducerException(String topic,
String msgId, Throwable e) {
+ StorageRuntimeException checkProducerException(String topic, String msgId,
Throwable e) {
if (e instanceof MQClientException) {
if (e.getCause() != null) {
if (e.getCause() instanceof RemotingTimeoutException) {
@@ -107,7 +107,7 @@ public abstract class AbstractProducer {
|| e.getCause() instanceof RemotingConnectException) {
if (e.getCause() instanceof MQBrokerException) {
MQBrokerException brokerException =
(MQBrokerException) e.getCause();
- return new StorageConnectorRuntimeException(
+ return new StorageRuntimeException(
String.format("Received a broker exception,
Topic=%s, msgId=%s, %s",
topic, msgId,
brokerException.getErrorMessage()), e);
}
@@ -115,7 +115,7 @@ public abstract class AbstractProducer {
if (e.getCause() instanceof RemotingConnectException) {
RemotingConnectException connectException =
(RemotingConnectException) e.getCause();
- return new StorageConnectorRuntimeException(
+ return new StorageRuntimeException(
String.format(
"Network connection experiences failures.
Topic=%s, msgId=%s, %s",
topic, msgId, connectException.getMessage()),
e);
@@ -125,7 +125,7 @@ public abstract class AbstractProducer {
// Exception thrown by local.
MQClientException clientException = (MQClientException) e;
if (-1 == clientException.getResponseCode()) {
- return new StorageConnectorRuntimeException(
+ return new StorageRuntimeException(
String.format("Topic does not exist, Topic=%s,
msgId=%s",
topic, msgId), e);
} else if (ResponseCode.MESSAGE_ILLEGAL ==
clientException.getResponseCode()) {
@@ -135,21 +135,21 @@ public abstract class AbstractProducer {
}
}
}
- return new StorageConnectorRuntimeException("Send message to RocketMQ
broker failed.", e);
+ return new StorageRuntimeException("Send message to RocketMQ broker
failed.", e);
}
protected void checkProducerServiceState(DefaultMQProducerImpl producer) {
switch (producer.getServiceState()) {
case CREATE_JUST:
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("You do not have start the producer, %s",
producer.getServiceState()));
case SHUTDOWN_ALREADY:
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Your producer has been shut down, %s",
producer.getServiceState()));
case START_FAILED:
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("When you start your service throws an
exception, %s",
producer.getServiceState()));
case RUNNING:
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImpl.java
index 3e02b7b56..db861305a 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImpl.java
@@ -21,7 +21,7 @@ import org.apache.eventmesh.api.RequestReplyCallback;
import org.apache.eventmesh.api.SendCallback;
import org.apache.eventmesh.api.SendResult;
import org.apache.eventmesh.api.exception.OnExceptionContext;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.storage.rocketmq.cloudevent.RocketMQMessageFactory;
import org.apache.eventmesh.storage.rocketmq.utils.CloudEventUtils;
@@ -175,7 +175,7 @@ public class ProducerImpl extends AbstractProducer {
@Override
public void onException(Throwable e) {
String topic = message.getTopic();
- StorageConnectorRuntimeException onsEx =
ProducerImpl.this.checkProducerException(topic, null, e);
+ StorageRuntimeException onsEx =
ProducerImpl.this.checkProducerException(topic, null, e);
OnExceptionContext context = new OnExceptionContext();
context.setTopic(topic);
context.setException(onsEx);
@@ -196,7 +196,7 @@ public class ProducerImpl extends AbstractProducer {
@Override
public void onException(Throwable e) {
String topic = message.getTopic();
- StorageConnectorRuntimeException onsEx =
ProducerImpl.this.checkProducerException(topic, null, e);
+ StorageRuntimeException onsEx =
ProducerImpl.this.checkProducerException(topic, null, e);
OnExceptionContext context = new OnExceptionContext();
context.setTopic(topic);
context.setException(onsEx);
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/test/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImplTest.java
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/test/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImplTest.java
index e003e6f0f..843669ccc 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/test/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImplTest.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/test/java/org/apache/eventmesh/storage/rocketmq/producer/ProducerImplTest.java
@@ -21,7 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Fail.failBecauseExceptionWasNotThrown;
import static org.mockito.ArgumentMatchers.any;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.common.Constants;
import org.apache.rocketmq.client.exception.MQBrokerException;
@@ -126,7 +126,7 @@ public class ProducerImplTest {
.withData(new byte[]{'a'})
.build();
producer.send(cloudEvent);
-
failBecauseExceptionWasNotThrown(StorageConnectorRuntimeException.class);
+ failBecauseExceptionWasNotThrown(StorageRuntimeException.class);
} catch (Exception e) {
assertThat(e).hasMessageContaining("Send message to RocketMQ
broker failed.");
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-standalone/src/main/java/org/apache/eventmesh/storage/standalone/producer/StandaloneProducer.java
b/eventmesh-storage-plugin/eventmesh-storage-standalone/src/main/java/org/apache/eventmesh/storage/standalone/producer/StandaloneProducer.java
index 025fa6420..a89afd70e 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-standalone/src/main/java/org/apache/eventmesh/storage/standalone/producer/StandaloneProducer.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-standalone/src/main/java/org/apache/eventmesh/storage/standalone/producer/StandaloneProducer.java
@@ -21,7 +21,7 @@ import org.apache.eventmesh.api.RequestReplyCallback;
import org.apache.eventmesh.api.SendCallback;
import org.apache.eventmesh.api.SendResult;
import org.apache.eventmesh.api.exception.OnExceptionContext;
-import org.apache.eventmesh.api.exception.StorageConnectorRuntimeException;
+import org.apache.eventmesh.api.exception.StorageRuntimeException;
import org.apache.eventmesh.storage.standalone.broker.StandaloneBroker;
import org.apache.eventmesh.storage.standalone.broker.model.MessageEntity;
@@ -76,7 +76,7 @@ public class StandaloneProducer {
return sendResult;
} catch (Exception e) {
log.error("send message error, topic: {}",
cloudEvent.getSubject(), e);
- throw new StorageConnectorRuntimeException(
+ throw new StorageRuntimeException(
String.format("Send message error, topic: %s",
cloudEvent.getSubject()));
}
}
@@ -92,7 +92,7 @@ public class StandaloneProducer {
OnExceptionContext onExceptionContext =
OnExceptionContext.builder()
.messageId(cloudEvent.getId())
.topic(cloudEvent.getSubject())
- .exception(new StorageConnectorRuntimeException(ex))
+ .exception(new StorageRuntimeException(ex))
.build();
sendCallback.onException(onExceptionContext);
}
@@ -113,24 +113,24 @@ public class StandaloneProducer {
OnExceptionContext onExceptionContext =
OnExceptionContext.builder()
.messageId(cloudEvent.getId())
.topic(cloudEvent.getSubject())
- .exception(new StorageConnectorRuntimeException(ex))
+ .exception(new StorageRuntimeException(ex))
.build();
sendCallback.onException(onExceptionContext);
}
}
public void request(CloudEvent cloudEvent, RequestReplyCallback
rrCallback, long timeout) throws Exception {
- throw new StorageConnectorRuntimeException("Request is not supported");
+ throw new StorageRuntimeException("Request is not supported");
}
public boolean reply(CloudEvent cloudEvent, SendCallback sendCallback)
throws Exception {
- throw new StorageConnectorRuntimeException("Reply is not supported");
+ throw new StorageRuntimeException("Reply is not supported");
}
public void checkTopicExist(String topic) throws Exception {
boolean exist = standaloneBroker.checkTopicExist(topic);
if (!exist) {
- throw new StorageConnectorRuntimeException(String.format("topic:%s
is not exist", topic));
+ throw new StorageRuntimeException(String.format("topic:%s is not
exist", topic));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]