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

[improve][doc] Java example explaining code without using lombok #19019

Merged
merged 4 commits into from
Dec 26, 2022
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
22 changes: 16 additions & 6 deletions site2/docs/schema-understand.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,25 @@ Pulsar gets the schema definition from the predefined `struct` using an Avro lib
1. Create the _User_ class to define the messages sent to Pulsar topics.

```java
# If you use Lombok

@Builder
@AllArgsConstructor
@NoArgsConstructor
AlvaroStream marked this conversation as resolved.
Show resolved Hide resolved
public static class User {
public String name;
public int age;
public User(String name, int age) {
this.name = name;
this.age = age
}
public User() {}
}

# If you DON'T use Lombok you will need to add the constructor like this
#
# public static class User {
# String name;
# int age;
# public User() { }
# public User(String name, int age) { this.name = name; this.age = age; } }
#}

```

2. Create a producer with a `struct` schema and send messages.
Expand Down Expand Up @@ -363,4 +373,4 @@ The following table outlines the mapping between the schema compatibility check
| `ALWAYS_INCOMPATIBLE` | N/A | The schema evolution is disabled. |
| <li>`BACKWARD` </li><li>`BACKWARD_TRANSITIVE` </li> | Consumer first | There is no guarantee that consumers using the old schema can read data produced using the new schema. Consequently, **upgrade all consumers first**, and then start producing new data. |
| <li>`FORWARD` </li><li>`FORWARD_TRANSITIVE` </li> | Producer first | There is no guarantee that consumers using the new schema can read data produced using the old schema. Consequently, **upgrade all producers first** to use the new schema and ensure the data that has already been produced using the old schemas are not available to consumers, and then upgrade the consumers. |
| <li>`FULL` </li><li>`FULL_TRANSITIVE` </li> | Any order | It is guaranteed that consumers using the old schema can read data produced using the new schema and consumers using the new schema can read data produced using the old schema. Consequently, you can upgrade the producers and consumers in **any order**. |
| <li>`FULL` </li><li>`FULL_TRANSITIVE` </li> | Any order | It is guaranteed that consumers using the old schema can read data produced using the new schema and consumers using the new schema can read data produced using the old schema. Consequently, you can upgrade the producers and consumers in **any order**. |