View with stream updates not visible in `Components`

Hello!

I have a view that’s supposed to stream changes back. However, I can’t call the view from an action because it’s not part of components.

service SnapshotView {
  // Updates omitted
  rpc StreamUpdates(StreamUpdatesRequest) returns (stream Snapshot) {
    option (kalix.method).view.query = {
      query: "SELECT * FROM snapshots WHERE user_id = :user_id"
      stream_updates: true
    };
  };
}

message StreamUpdatesRequest {
  optional string user_id = 1;
}
message Snapshot {
  optional string user_id = 1;
  ...
}

After sbt compile, I’m not able to see the components.snapshotViewImpl when trying to call it from an action.

Removing the stream_updates: true and keeping only returns (stream Snapshot) still has the issue.

Removing both the stream_updates: true and using returns (Snapshot), I’m able to see components.snapshotViewImpl from the action.

This looks like a bug? Not sure what I’m doing wrong.

Streaming result cross component calls are not (yet) possible to do with the Java/Scala protobuf SDK. It is tracked by issue Allow deferred stream-out calls · Issue #674 · lightbend/kalix-jvm-sdk · GitHub

I think a workaround for a view could be to project the result into a single response message with a nested array with the results, shown in the docs here: Implementing Views in Java or Scala :: Kalix Documentation

Thanks @johanandren . I see there’s already a ticket to document it.

For now I think I can find a workaround by building the view one call away from the client.