You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/06/21 10:10:57 UTC
[camel] branch main updated: CAMEL-18212: Introduce a dedicated exception type for when a reactive stream has no active subscriptions
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton 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 0f074092278 CAMEL-18212: Introduce a dedicated exception type for when a reactive stream has no active subscriptions
0f074092278 is described below
commit 0f0740922781edd39c3e91145491dff4ca36a2a1
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Jun 21 09:00:09 2022 +0100
CAMEL-18212: Introduce a dedicated exception type for when a reactive stream has no active subscriptions
---
...ctiveStreamsNoActiveSubscriptionsException.java | 32 ++++++++++++++++++++++
.../reactive/streams/engine/CamelPublisher.java | 4 ++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsNoActiveSubscriptionsException.java b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsNoActiveSubscriptionsException.java
new file mode 100644
index 00000000000..8bf455a3922
--- /dev/null
+++ b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsNoActiveSubscriptionsException.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.reactive.streams;
+
+import org.apache.camel.RuntimeCamelException;
+
+public class ReactiveStreamsNoActiveSubscriptionsException extends RuntimeCamelException {
+ private final String streamName;
+
+ public ReactiveStreamsNoActiveSubscriptionsException(String message, String streamName) {
+ super(message);
+ this.streamName = streamName;
+ }
+
+ public String getStreamName() {
+ return streamName;
+ }
+}
diff --git a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/engine/CamelPublisher.java b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/engine/CamelPublisher.java
index 1918c326565..9647c9e4f21 100644
--- a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/engine/CamelPublisher.java
+++ b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/engine/CamelPublisher.java
@@ -31,6 +31,7 @@ import org.apache.camel.component.reactive.streams.ReactiveStreamsBackpressureSt
import org.apache.camel.component.reactive.streams.ReactiveStreamsComponent;
import org.apache.camel.component.reactive.streams.ReactiveStreamsEndpoint;
import org.apache.camel.component.reactive.streams.ReactiveStreamsHelper;
+import org.apache.camel.component.reactive.streams.ReactiveStreamsNoActiveSubscriptionsException;
import org.apache.camel.component.reactive.streams.ReactiveStreamsProducer;
import org.apache.camel.component.reactive.streams.api.DispatchCallback;
import org.reactivestreams.Publisher;
@@ -107,7 +108,8 @@ public class CamelPublisher implements Publisher<Exchange>, AutoCloseable {
sub.publish(data);
}
} else if (callback != null) {
- callback.processed(data, new IllegalStateException("The stream has no active subscriptions"));
+ callback.processed(data,
+ new ReactiveStreamsNoActiveSubscriptionsException("The stream has no active subscriptions", name));
}
}