Skip to content

Add "What's New?" document to the ref guide #579

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

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions spring-pulsar-docs/src/main/antora/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
* xref:index.adoc[Overview]
* xref:intro.adoc[Introduction]
** xref:intro/project-state.adoc[Project Status]
** xref:intro/system-requirements.adoc[System Requirements]
** xref:intro/building.adoc[Building the Project]
** xref:intro/getting-help.adoc[Getting Help]
* xref:whats-new.adoc[]
* xref:intro.adoc[]
** xref:intro/project-state.adoc[]
** xref:intro/system-requirements.adoc[]
** xref:intro/building.adoc[]
** xref:intro/getting-help.adoc[]
* xref:reference/reference.adoc[]
** xref:reference/pulsar.adoc[]
*** xref:reference/tombstones.adoc[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[building-project]]
== Building the Project
= Building the Project

include::../attributes/attributes-variables.adoc[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ void listen(String message) {

TIP: The properties used are direct Pulsar consumer properties, not the `spring.pulsar.consumer` application configuration properties

[[listener-auto-consume]]
==== Generic records with AUTO_CONSUME
If there is no chance to know the type of schema of a Pulsar topic in advance, you can use the `AUTO_CONSUME` schema type to consume generic records.
In this case, the topic deserializes messages into `GenericRecord` objects using the schema info associated with the topic.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
== Type mapping annotation

Another option for specifying default schema information to use for a particular message type is to mark the message class with the `@PulsarMessage` annotation.
The schema info can be specified via the `schemaType` attribute on the annotation.

The following example configures the system to use JSON as the default schema when producing or consuming messages of type `Foo`:

[source,java,indent=0,subs="verbatim"]
----
@PulsarMessage(schemaType = SchemaType.JSON)
record Foo(String value) {
}
----
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,3 @@ public SchemaResolverCustomizer<DefaultSchemaResolver> schemaResolverCustomizer(
}
}
----

==== Type mapping annotation
Another option for specifying default schema information to use for a particular message type is to mark the message class with the `@PulsarMessage` annotation.
The schema info can be specified via the `schemaType` attribute on the annotation.

The following example configures the system to use JSON as the default schema when producing or consuming messages of type `Foo`:

[source,java,indent=0,subs="verbatim"]
----
@PulsarMessage(schemaType = SchemaType.JSON)
record Foo(String value) {
}
----
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ This removes the need to set the schema on the listener as the framework consult

include::custom-schema-mapping.adoc[]

[[listener-default-schema-annotation]]
include::custom-schema-mapping-annotation.adoc[leveloffset=+2]

With this configuration in place, there is no need to set the schema on the listener, for example:

include::{listener-class}/listener-snippet.adoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ This removes the need to specify the schema as the framework consults the resolv

include::custom-schema-mapping.adoc[]

[[template-default-schema-annotation]]
include::custom-schema-mapping-annotation.adoc[leveloffset=+2]

With this configuration in place, there is no need to set specify the schema on send operations.

[[template-auto-produce]]
=== Producing with AUTO_SCHEMA
If there is no chance to know the type of schema of a Pulsar topic in advance, you can use an {apache-pulsar-docs}/schema-get-started/#auto_produce[AUTO_PRODUCE] schema to publish a raw JSON or Avro payload as a `byte[]` safely.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ NOTE: The `message-type` is the fully-qualified name of the message class.

WARNING: If the message (or the first message of a `Publisher` input) is `null`, the framework won't be able to determine the topic from it. Another method shall be used to specify the topic if your application is likely to send `null` messages.

[[default-topic-via-annotation]]
=== Specified via annotation

When no topic is passed into the API and there are no custom topic mappings configured, the system looks for a `@PulsarMessage` annotation on the class of the message being produced or consumed.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
= What's new?

[[what-s-new-in-1-1-since-1-0]]
== What's New in 1.1 Since 1.0
:page-section-summary-toc: 1

This section covers the changes made from version 1.0 to version 1.1.

=== Auto Schema support
If there is no chance to know the schema of a Pulsar topic in advance, you can use AUTO Schemas to produce/consume generic records to/from brokers.
See xref:./reference/pulsar.adoc#template-auto-produce[Producing with AUTO_SCHEMA] and xref:./reference/pulsar.adoc#listener-auto-consume[Consuming with AUTO_SCHEMA] for more details.

NOTE: While the above links focus on `PulsarTemplate` and `@PulsarListener`, this feature is also supported in `ReactivePulsarTemplate`, `@ReactivePulsarListener`, and `@PulsarReader`.
Details for each can be found in their respective section of this reference guide.

=== Default topic/schema via message annotation
You can now mark a message class with `@PulsarMessage` to specify the xref:./reference/pulsar.adoc#default-topic-via-annotation[default topic] and/or xref:./reference/pulsar.adoc#listener-default-schema-annotation[default schema] to use when producing/consuming messages of that type.

=== Remove checked exceptions
The APIs provided by the framework no longer throw the checked `PulsarClientException`, but rather the unchecked `PulsarException`.

WARNING: If you were previously catching or rethrowing `PulsarClientException` just to appease the compiler and were not actually handling the exception, you can simply remove your `catch` or `throws` clause.
If you were actually handling the exception then you will need to replace `PulsarClientException` with `PulsarException` in your catch clause.