这是我的代码:
@Path("/hello")
@AllArgsConstructor
public class GreetingResource {
private final Driver driver;
@GET
@Produces(MediaType.TEXT_PLAIN)
public Uni<String> hello() {
return Multi.createFrom().resource(
driver::rxSession,
session -> session.readTransaction(tx -> {
RxResult result = tx.run("MATCH (f:Fruit) RETURN f.name as name ORDER BY f.name");
return Multi.createFrom().publisher(result.records()).map(record -> record.get("name").asString());
})
).withFinalizer(session -> {
return Multi.createFrom().publisher(session.close());
});
}
}
我收到这两条编译消息:
Type mismatch: cannot convert from Multi<Object> to Uni<String>
Type mismatch: cannot convert from Multi<Object> to Uni<Void>
我不太清楚,因为record.get("name").asString
给我一个String
...
有任何想法吗?