Skip to content

Commit daeba53

Browse files
committed
Update KafkaShowcase.java
extract constant
1 parent 58b67b2 commit daeba53

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/kafka

‎sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/kafka/KafkaShowcase.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222

2323
public final class KafkaShowcase {
2424

25+
public static final String TOPIC = "sentry-topic-console-sample";
26+
2527
private KafkaShowcase() {}
2628

2729
public static void demonstrate(final String bootstrapServers) {
28-
final String topic = "sentry-topic-console-sample";
2930
final CountDownLatch consumedLatch = new CountDownLatch(1);
30-
final Thread consumerThread = startKafkaConsumerThread(topic, bootstrapServers, consumedLatch);
31+
final Thread consumerThread = startKafkaConsumerThread(TOPIC, bootstrapServers, consumedLatch);
3132

3233
final Properties producerProperties = new Properties();
3334
producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
@@ -45,7 +46,7 @@ public static void demonstrate(final String bootstrapServers) {
4546
try (ISentryLifecycleToken ignored = transaction.makeCurrent()) {
4647
try (KafkaProducer<String, String> producer = new KafkaProducer<>(producerProperties)) {
4748
Thread.sleep(500);
48-
producer.send(new ProducerRecord<>(topic, "sentry-kafka sample message")).get();
49+
producer.send(new ProducerRecord<>(TOPIC, "sentry-kafka sample message")).get();
4950
} catch (InterruptedException e) {
5051
Thread.currentThread().interrupt();
5152
} catch (Exception ignoredException) {

0 commit comments

Comments
 (0)