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

Add support for AUTO_PRODUCE schema #572

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

onobc
Copy link
Collaborator

@onobc onobc commented Feb 11, 2024

This commit adds support for producing raw JSON or Avro payloads with AUTO_SCHEMA.

This commit adds support for producing raw JSON or Avro payloads with
AUTO_SCHEMA.
@onobc onobc added the type: feature A new feature or enhacement label Feb 11, 2024
@onobc onobc added this to the 1.1.0-M1 milestone Feb 11, 2024
@@ -14,7 +14,7 @@
:spring-cloud-stream-docs: https://docs.spring.io/spring-cloud-stream/docs/{spring-cloud-stream-version}/reference/html/
:spring-cloud-function: https://spring.io/projects/spring-cloud-function

:apache-pulsar-docs: https://pulsar.apache.org/docs/3.1.x
:apache-pulsar-docs: https://pulsar.apache.org/docs/3.2.x
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[UNRELATED] Bump in docs to current version

@@ -193,7 +197,8 @@ static class ProducerCacheKey<T> {
Assert.notNull(schema, () -> "'schema' must be non-null");
Assert.notNull(topic, () -> "'topic' must be non-null");
this.schema = schema;
this.schemaHash = SchemaHash.of(this.schema);
this.schemaHash = (schema instanceof AutoProduceBytesSchema) ? AUTO_PRODUCE_SCHEMA_HASH
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is necessary as any call to AutoProduceSchema.getSchemaInfo() will throw RuntimeException on the client until after something has been sent and validated w/ the target topic (i.e a schema is initialized on it). In our case, we don't care about schema info, the producer can be used for any byte[] messages that the user wants to be validated against the target topic schema and this cache key will do that.

@@ -74,7 +75,7 @@ void cleanupFromTests() {
}

@Test
void createProducerMultipleCalls() throws PulsarClientException {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[UNRELATED] Leftover from removal of checked exception in Spring Pulsar APIs.

@onobc onobc merged commit 0e95f3c into spring-projects:main Feb 14, 2024
7 checks passed
@onobc onobc deleted the add-auto-produce-schema branch February 14, 2024 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new feature or enhacement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant