This is an automated email from the ASF dual-hosted git repository. orpiske 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 afed46d (chores): camel-pulsar cleanups (#5459) afed46d is described below commit afed46da909507da9733d777d2e66fdbdc47837c Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com> AuthorDate: Fri Apr 23 14:32:40 2021 +0200 (chores): camel-pulsar cleanups (#5459) - simplify exception handling when stopping consumers - consolidate duplicate consumer start up logic --- .../org/apache/camel/component/pulsar/PulsarConsumer.java | 6 +----- .../org/apache/camel/component/pulsar/utils/PulsarUtils.java | 11 ++++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConsumer.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConsumer.java index 600c561..a5cfcd6 100644 --- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConsumer.java +++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConsumer.java @@ -64,11 +64,7 @@ public class PulsarConsumer extends DefaultConsumer { @Override protected void doResume() throws Exception { - pulsarConsumers = stopConsumers(pulsarConsumers); - - Collection<Consumer<byte[]>> consumers = createConsumers(pulsarEndpoint, consumerCreationStrategyFactory); - - pulsarConsumers.addAll(consumers); + doStart(); } private Collection<Consumer<byte[]>> createConsumers( diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/PulsarUtils.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/PulsarUtils.java index d99af4d..7f6b406 100644 --- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/PulsarUtils.java +++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/PulsarUtils.java @@ -37,14 +37,11 @@ public final class PulsarUtils { if (consumer != null) { try { consumer.close(); - } catch (Exception e) { + } catch (PulsarClientException.AlreadyClosedException e) { // ignore during stopping - if (e instanceof PulsarClientException.AlreadyClosedException) { - // ignore - } else { - LOG.debug("Error stopping consumer: {} due to {}. This exception is ignored", consumer, - e.getMessage(), e); - } + } catch (Exception e) { + LOG.debug("Error stopping consumer: {} due to {}. This exception is ignored", consumer, + e.getMessage(), e); } } }