Skip to content

Sink<GenericObject> unwrap internal AutoConsumeSchema and allow to handle topics with KeyValue schema - #10211

Merged
eolivelli merged 43 commits into
apache:masterfrom
eolivelli:impl/sink-keyvalue
Apr 17, 2021
Merged

Sink<GenericObject> unwrap internal AutoConsumeSchema and allow to handle topics with KeyValue schema#10211
eolivelli merged 43 commits into
apache:masterfrom
eolivelli:impl/sink-keyvalue

Conversation

@eolivelli

@eolivelli eolivelli commented Apr 13, 2021

Copy link
Copy Markdown
Contributor

Motivation

When you run a Sink (or Sink) you are using AutoConsumeSchema and AutoConsumeSchema is a wrapper around the actual schema attached to the topic.

In case of a topic with KeyValueSchema you are not able to access the Key Schema and the Value Schema because Record#getSchema returns the AutoConsumeSchema and not the KeyValueSchema itself.

Modifications

  • In SinkRecord#getSchema we unwrap the AutoConsumeSchema schema and allow to access the actual schema set on the topic.
  • Add new integration test
  • Add handling of TopicMessageImpl in PulsarSource (as we are doing with MessageImpl)

The test sets a property on the message with the expected schema type, this way the sink breaks in case of some error in the system and bad detection of the schema.

Verifying this change

This change added tests

Documentation

I am going to write documentation about how to write Pulsar IO Sinks that work with any schema without binding to a specific schema at compile time (Sink)

@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@sijie sijie added this to the 2.8.0 milestone Apr 13, 2021
@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@eolivelli

Copy link
Copy Markdown
Contributor Author

I am adding debug in order to see what's wrong in CI.
I will revert all of the debug code when I see CI green

@eolivelli

Copy link
Copy Markdown
Contributor Author

@codelipenghui I finally figured out what was wrong in the integration test. now it passes locally.
Can you please take a final look ?

@eolivelli
eolivelli merged commit 0f07dda into apache:master Apr 17, 2021
@eolivelli
eolivelli deleted the impl/sink-keyvalue branch April 17, 2021 08:14
eolivelli added a commit to datastax/pulsar that referenced this pull request May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants