Hi,
I have been trying to find a way to test views. Since I do not find any example yet I tried using integration test to test things out. However when I run the test, I do get the error:
{“timestamp”:“2022-12-11T08:04:35.204Z”,“thread”:“kalix-akka.actor.default-dispatcher-4”,“logger”:“kalix.javasdk.impl.DiscoveryImpl”,“message”:“Error reported from Kalix system: KLX-00121 An incoming event for the view [CustomerByCityStreaming] was missing the subject id attribute ce-subject
, view updates are stalled.\n\nEach update passed to a view must have a subject id, used as a primary key in the view, each unique subject-id can only have one entry in the view, if the update comes from a message broker the subject id is defined with the cloud event attribute [ce-subject]. \n\nAt customer/view/customer_view.proto:134:1:\nservice CustomerByCityStreaming {\n option (kalix.codegen) = {\n view: {}\n };\n\n // update methods omitted”,“context”:“default”,“severity”:“ERROR”}
What I had in the test was:
private val viewClient = testKit.getGrpcClient(classOf[CustomerByCityStreaming])
val result =
viewClient.processCustomerCreated(CustomerCreated(Some(CustomerState("1", "email@email.com", "name", None))))
result.futureValue shouldBe Customer("1", "email@email.com", "name", None)
Is there any example that I can follow or how do we properly test view code? Thanks for your help.