-
Notifications
You must be signed in to change notification settings - Fork 8
Event model in Java
Fernando Benjamin edited this page May 18, 2016
·
13 revisions
The java client uses Jackson for serializing/deserializing json content, to use this default serialization logic you need to use the Jackson annotations on your Event model:
-
Annotate the constructor with the Jackson
@JsonCreater
. -
Annotate each constructor parameter with
@JsonProperty
.
import org.zalando.nakadi.client.java.model.Event;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class MeetingsEvent implements Event {
private final String date;
private final String topic;
@JsonCreator
public MeetingsEvent(@JsonProperty("date") String date,
@JsonProperty("topic") String topic) {
this.date = date;
this.topic = topic;
}
public String getDate() {
return date;
}
public String getTopic() {
return topic;
}
}
- How to use it in your project?
- How to subscribe to Events?
- How to publish an event?
- How to use it in your project?
- How to subscribe to Events?
- How to publish an event?