Skip to content

The Java services subscribe to broad events and complain when receiving them

This is the copy of squash-autom-devops/java-plugins/-/issues/21 for Micronaut repository.

Current situation

Some Java services subscribed to the following events:

[2023-02-20 21:04:55,787] DEBUG in eventbus: Processing subscription request for 'result.aggregator.execution-command':
[2023-02-20 21:04:55,787] DEBUG in eventbus:   FieldSelector is ['kind==ExecutionCommand'].
[2023-02-20 21:04:55,787] DEBUG in eventbus:   LabelSelector is [].
[2023-02-20 21:04:55,788] DEBUG in eventbus: Subscription 'result.aggregator.execution-command' successfully registered (id=05864bf3-1150-41c2-a368-57cb9ce41ee1).

And then they complain:

[2023-02-21 11:08:15,104] ERROR in eventbus: Publication status code from 05864bf3-1150-41c2-a368-57cb9ce41ee1 is 422.  Failure details: {"metadata":{},"apiVersion":"v1","status":null,"message":null,"reason":"Invalid message for kind opentestfactory.org/v1beta1/ExecutionCommand","details":{"validationReport":"The event opentestfactory.org/v1beta1/ExecutionCommand is not accepted by this module. List of accepted events :\nopentestfactory.org/v1alpha1/WorkflowCompleted\nopentestfactory.org/v1alpha1/WorkflowCanceled\nopentestfactory.org/v1alpha1/ExecutionCommand\nopentestfactory.org/v1alpha1/ExecutionResult\n"},"code":422,"kind":"Status"}.

Desired outcome

A proper subscription, restricting to the handled version. (And, as an added bonus, they should handle the current version of the messages.)