我正在尝试在 Quarkus 框架上学习使用 ReactiveMongoClient。
我以 Uni> 的身份发送回复部分成功
@GET
@Path("/unpaginated")
public Uni<List<Staff>> unpaginatedStaffList() {
return staffService.getStaffResponse();
}
但是,当我尝试让某个其他类(StaffResponse)的对象包含一个用于分页的 Link 对象时,我没有得到任何 Staff 记录。(现在我已经硬编码了分页链接)
@GET
@Path("/paginated")
public StaffResponse paginatedStaffList() {
List<Link> links = LinkService.getLinks("/staff?page=2&limit=20", "next");
Uni<List<Staff>> staff = (Uni<List<Staff>>) staffService.getStaffResponse();
return new StaffResponse(links, staff);
}
响应中的“员工”为空。
MongoClient 正在返回 Staff 列表,看起来 Response 对象没有获取列表。尝试阅读 SmallRye Mutiny 文档 - 无法解决。
请帮忙。
我已在以下位置提交代码:https ://github.com/doepradhan/staffApi 和一个示例 json 数据文件(https://github.com/doepradhan/staffApi/blob/master/sample-staff-data.json)
谢谢你的帮助。