Implementing the domain model

Implementing the domain model Taxi using Spring Data Redis annotations will look like the following, which is available in spring-boot-2-taxi-service:

@RedisHash("Taxi")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Taxi implements Serializable {
@Id
private String taxiId;

private TaxiType taxiType;

private TaxiStatus taxiStatus;
}

Implementing the domain model TaxiBooking using Spring Data Redis annotations will look like the following which is available in spring-boot-2-taxi-book-service:

@RedisHash("TaxiBooking")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaxiBooking {
@Id
private String taxiBookingId;

private Point start;

private Date startTime;

private Point end;

private Date endTime;

private Date bookedTime;

private Date acceptedTime;

private Long customerId;

private TaxiBookingStatus bookingStatus;

private String reasonToCancel;

private Date cancelTime;

private String taxiId;
}

The @RedisHash annotation is used to store the contents of this domain model as a Redis Map with @Id used to mark the id field for this model. The annotations @Data is from Lombok library to generate toString, equals, hashCode, and getters/setters for this model. The start and end attributes are of type org.springframework.data.geo.Point, which is used to store coordinates. The @AllArgsConstructor annotation is used to generate the all arguments constructor and @NoArgsConstructor is used to generate a default constructor without any arguments.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.60.158