Action (consuming from topic) receives unexpected events

I have an eventsourced-entity which produces 3 types of domain-events.
There is an action which consumes these domain-events and converts them into a single uniform (dto)event-type, which gets published to a topic (“data_topic”).

service PublishToTopicService {
    option (kalix.codegen) = {
        action: {}
    };
    rpc PublishDomainEvent(be.reaktika.weatherstation.domain.Event) returns (Dto){
        option (kalix.method).eventing.in = {
            event_sourced_entity: "entity"
        };
        option (kalix.method).eventing.out= {
            topic: "data_topic"
        };
    }

There is also an action which consumes those dto-events and dispatches them to entities (ConsumeService).

service ConsumeService {
   option (kalix.codegen) = {
       action: {}
   };
   rpc DispatchDto(Dto) returns (google.protobuf.Empty){
       option (kalix.method).eventing.in = {
           topic: "data_topic"
       };
   }

The idea is to isolate the specifics of the different entities from eachother by means of this entity-agnostic topic in between.
When posting a message to the public-API (which forwards to the eventsourced-entity, and eventually results in a message being published to the topic), I see this error:

2022-07-11 11:37:31,473 ERROR kalix.javasdk.impl.DiscoveryImpl - Error reported from Kalix system: KLX-00407 No method can be found on service [be.reaktika.weatherstation.action.ConsumeService] to handle protobuf type of [type.googleapis.com/type.googleapis.com/<domain-event>] on input [topic: "data_topic"].

To fix this either declare a method for this type, or declare a method that accepts `google.protobuf.Any` (accepted types are: be.reaktika.weatherstation.action.Dto).

When I add a ‘catch-all’ handler, as is suggested by the message, and log the ‘ignored’ messages, I can see that the consumer, which is supposed to only receive dto-events, is in fact receiving domain-events.
Eventhough this consumer is not configured to subscribe to events of the domain-entity, and the domain-events not not being published on the topic that the consumer-action is subscibing to, the consumer receives domain-events.

I tried clearing the kalix-proxy, and changing the version of my application (because I suspected some sort of mixup of old and new code), but the problem persists.

What am I missing here?

Hi,

I noticed that on the error there appears to be some duplication protobuf type of [type.googleapis.com/type.googleapis.com/<domain-event>]. We’ve have seen that type of problem before when there’s reuse of metadata from the incoming event to the outgoing one. The advice would be to make sure you create a new object for the metadata as mentioned here by Johan.

I’m not sure if this would cause all the issues you mention but I believe fixing that and retrying might be a good start.

1 Like

Thank you! That cleared things up for me.
I had the metadata like this: Error KLX-00121 with a view based on a topic