diff --git a/binders/pulsar-binder/spring-cloud-stream-binder-pulsar/src/test/java/org/springframework/cloud/stream/binder/pulsar/PulsarBinderIntegrationTests.java b/binders/pulsar-binder/spring-cloud-stream-binder-pulsar/src/test/java/org/springframework/cloud/stream/binder/pulsar/PulsarBinderIntegrationTests.java index b8b7e7317..d02b1d201 100644 --- a/binders/pulsar-binder/spring-cloud-stream-binder-pulsar/src/test/java/org/springframework/cloud/stream/binder/pulsar/PulsarBinderIntegrationTests.java +++ b/binders/pulsar-binder/spring-cloud-stream-binder-pulsar/src/test/java/org/springframework/cloud/stream/binder/pulsar/PulsarBinderIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import java.util.function.Consumer; import java.util.function.Supplier; import org.apache.pulsar.client.api.Producer; -import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.schema.JSONSchema; import org.apache.pulsar.common.schema.KeyValue; @@ -672,25 +671,43 @@ class PulsarBinderIntegrationTests implements PulsarTestContainerSupport { } @Override - public Producer createProducer(Schema schema, String topic) throws PulsarClientException { - var producer = this.trackedProducerFactory.createProducer(schema, topic); + public Producer createProducer(Schema schema, String topic) { + Producer producer = null; + try { + producer = this.trackedProducerFactory.createProducer(schema, topic); + } + catch (Exception e) { + // pass through + } this.producersCreated.add(producer); return producer; } @Override public Producer createProducer(Schema schema, String topic, - ProducerBuilderCustomizer customizer) throws PulsarClientException { - var producer = this.trackedProducerFactory.createProducer(schema, topic, customizer); + ProducerBuilderCustomizer customizer) { + Producer producer = null; + try { + producer = this.trackedProducerFactory.createProducer(schema, topic, customizer); + } + catch (Exception e) { + // pass through + } this.producersCreated.add(producer); return producer; } @Override public Producer createProducer(Schema schema, String topic, Collection encryptionKeys, - List> producerBuilderCustomizers) throws PulsarClientException { - var producer = this.trackedProducerFactory.createProducer(schema, topic, encryptionKeys, - producerBuilderCustomizers); + List> producerBuilderCustomizers) { + Producer producer = null; + try { + producer = this.trackedProducerFactory.createProducer(schema, topic, encryptionKeys, + producerBuilderCustomizers); + } + catch (Exception e) { + // pass through + } this.producersCreated.add(producer); return producer; } @@ -726,9 +743,14 @@ class PulsarBinderIntegrationTests implements PulsarTestContainerSupport { @Override public org.apache.pulsar.client.api.Consumer createConsumer(Schema schema, - Collection topics, String subscriptionName, ConsumerBuilderCustomizer customizer) - throws PulsarClientException { - var consumer = this.trackedConsumerFactory.createConsumer(schema, topics, subscriptionName, customizer); + Collection topics, String subscriptionName, ConsumerBuilderCustomizer customizer) { + org.apache.pulsar.client.api.Consumer consumer = null; + try { + consumer = this.trackedConsumerFactory.createConsumer(schema, topics, subscriptionName, customizer); + } + catch (Exception e) { + // pass through + } this.consumersCreated.add(consumer); return consumer; } @@ -736,9 +758,15 @@ class PulsarBinderIntegrationTests implements PulsarTestContainerSupport { @Override public org.apache.pulsar.client.api.Consumer createConsumer(Schema schema, Collection topics, String subscriptionName, Map metadataProperties, - List> consumerBuilderCustomizers) throws PulsarClientException { - var consumer = this.trackedConsumerFactory.createConsumer(schema, topics, subscriptionName, - metadataProperties, consumerBuilderCustomizers); + List> consumerBuilderCustomizers) { + org.apache.pulsar.client.api.Consumer consumer = null; + try { + consumer = this.trackedConsumerFactory.createConsumer(schema, topics, subscriptionName, + metadataProperties, consumerBuilderCustomizers); + } + catch (Exception e) { + // pass through + } this.consumersCreated.add(consumer); return consumer; }