Hi, I ran into a situation that I can not seem to fix.
I’ve got a view defined as
message GroupName {
string name = 1;
}
message UserName{
string username = 1;
}
rpc GetUsersInGroup(UserName) returns (stream GroupName) {
option (akkaserverless.method).view.query = {
query: "SELECT name from groups where username = :username"
};
}
Which allows me to query all groups where a username is part of.
But using this, does not allow me to use the GetUsersInGroup through components() (Allow deferred stream-out calls · Issue #674 · lightbend/akkaserverless-java-sdk · GitHub)
I read here I could also define it like this:
message GroupName {
repeated string name = 1;
}
rpc GetUsersInGroup(UserName) returns (GroupName) {
option (akkaserverless.method).view.query = {
query: "SELECT name from groups where username = :username"
};
}
But then I get internal errors when there is a single result:
java.lang.IllegalArgumentException: Wrong object type used with protocol message reflection.\n\tat com.google.protobuf.FieldSet.setField(FieldSet.java:279)
From what I could find this means that it is trying to push something that is not a list into a list.
Removing both stream and repeated results in More than one row found for a single row query
I need the component so I can access the view from an action, but also need the view to be able to return multiple result. Which means I’m a bit stuck and I hope that someone has a solution for me.
Edit: I’m using an integration test, have not deployed it yet
Regards,
Richard