Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulsar force schema fetch on pulsar-client-thread for all schema requiring schema info fetching #2494

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
import java.util.stream.Collectors;

import org.apache.pulsar.client.api.*;
import org.apache.pulsar.client.api.schema.KeyValueSchema;
import org.apache.pulsar.client.impl.MultiplierRedeliveryBackoff;
import org.apache.pulsar.client.impl.conf.ConsumerConfigurationData;
import org.apache.pulsar.client.impl.schema.AutoConsumeSchema;
import org.eclipse.microprofile.reactive.messaging.Message;

import io.opentelemetry.api.GlobalOpenTelemetry;
Expand All @@ -25,7 +23,6 @@
import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter;
import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingSpanNameExtractor;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
import io.smallrye.reactive.messaging.health.HealthReport;
import io.smallrye.reactive.messaging.pulsar.tracing.PulsarAttributesExtractor;
import io.smallrye.reactive.messaging.pulsar.tracing.PulsarTrace;
Expand Down Expand Up @@ -115,8 +112,8 @@ public PulsarIncomingChannel(PulsarClient client, Vertx vertx, Schema<T> schema,
.until(m -> closed.get())
.plug(msgMulti -> {
// Calling getValue on the pulsar-client-internal thread to make sure the SchemaInfo is fetched
if (schema instanceof AutoConsumeSchema || schema instanceof KeyValueSchema) {
return msgMulti.onItem().call(msg -> Uni.createFrom().item(msg::getValue));
if (schema.requireFetchingSchemaInfo()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same mechanism should be used for batch see line 141

return msgMulti.onItem().invoke(org.apache.pulsar.client.api.Message::getValue);
} else {
return msgMulti;
}
Expand All @@ -139,11 +136,8 @@ public PulsarIncomingChannel(PulsarClient client, Vertx vertx, Schema<T> schema,
.filter(m -> m.size() > 0)
.plug(msgMulti -> {
// Calling getValue on the pulsar-client-internal thread to make sure the SchemaInfo is fetched
if (schema instanceof AutoConsumeSchema || schema instanceof KeyValueSchema) {
return msgMulti.onItem().call(msg -> Uni.createFrom().item(() -> {
msg.forEach(m -> m.getValue());
return null;
}));
if (schema.requireFetchingSchemaInfo()) {
return msgMulti.onItem().invoke(msg -> msg.forEach(org.apache.pulsar.client.api.Message::getValue));
} else {
return msgMulti;
}
Expand Down
Loading