I tried to follow the doc and create the service to service eventing config in my micro-service. However, when i tried to emit the event, the rpc action “AnyEventReceived” cannot capture any event. Here is my configuration:
service CustomerEventsService {
option (kalix.codegen) = {
action: {}
};
option (kalix.service).eventing.in = {
event_sourced_entity: "customer"
};
option (kalix.service).eventing.out.direct.event_stream_id = "customer_events";
option (kalix.service).acl.allow = { service: "*" };
rpc AnyEventReceived(google.protobuf.Any) returns (google.protobuf.Any) { }
}
However, when I change the configuration to below, it can listen to the event and the rpc action “AnyEventReceived” can be executed.
service CustomerEventsService {
option (kalix.codegen) = {
action: {}
};
rpc AnyEventReceived(google.protobuf.Any) returns (google.protobuf.Any) {
option (kalix.method).eventing.in = {
event_sourced_entity: "customer"
};
}
}
So, anyone know the root cause?
1 Like
I just tried the example from kalix-jvm-sdk/samples/java-protobuf-eventsourced-customer-registry at main · lightbend/kalix-jvm-sdk · GitHub
It also does not work. I cannot see any event captured by CustomerEventsServiceAction. Is there any special setup required to run the service-to-service eventing example?
Hi @faichun
In the case of direct eventing, if you don’t subscribe to it (with eventing.in.direct
), you won’t observe rpc methods invocations. To test it, you would need to run java-protobuf-eventsourced-customer-registry
together with java-protobuf-eventsourced-customer-registry-subscriber
. BTW I’ve noticed that Readme files for Java samples are outdated, I’m fixing that right now. Also, we are currently working on making running multiple services locally for development easier.
Please ping me if you have any problems with testing it locally.
Prefect, Thanks @aludwiko
I can run the app now. I just realized that i have to run both together as well as fixing some ports issue.
Now, I assign the port forwarding to be 9001:9000 (for publisher app), and 9002:9000 (for subscriber app) in docker config. Also, in docker config and application.config, I have to define ${USER_FUNCTION_PORT:-8080} uniquely for each app (e.g. 38081 for publisher and 38082 for subscriber). Finally, in the protobuf of subscriber where using the service eventing, I have to set that port to the publisher app (e.g. 9001) in my case.
Ok, it should work, but if you would like to make a cross components calls, then you would need to also remap the internal 9000 port, like here: Action to action call fails for "9001:9000" proxy port - #3 by aludwiko