smallrye-reactive-messaging icon indicating copy to clipboard operation
smallrye-reactive-messaging copied to clipboard

message interceptors

Open Ladicek opened this issue 3 years ago • 3 comments

It would be useful to have a notion of "message interceptors" for cases when you want to apply some cross-cuting logic to all messages on a number of channels (one, more than one, all). I hear from @cescoffier that this was discussed in MP Reactive Messaging, but couldn't find an issue in https://github.com/eclipse/microprofile-reactive-messaging/issues We could perhaps discuss the idea here and build a prototype in SmallRye.

Based on this discussion: https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Use.20RequestScoped-bean.20in.20Kafka-Interceptor

Ladicek avatar Mar 31 '21 08:03 Ladicek

That was related to https://github.com/eclipse/microprofile-reactive-messaging/issues/72.

cescoffier avatar Mar 31 '21 08:03 cescoffier

Is there any progress on this one? We are still looking for a solution for our problem discussed in https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Use.20RequestScoped-bean.20in.20Kafka-Interceptor. A solution with a CDI-Decorator does not seem to work, maybe because of the needed @Channel-annotation. Decorator is just not used.

So I'm still searching for a solution to intercept sending/receiving of Kafka-Messages in a way that I can read some values out of a @RequestScoped CDI-bean.

wicksim avatar Jan 05 '22 08:01 wicksim

Would be interesting to have this feature. For outgoing messages we have our custom implementation of the Emitter. For incoming messages, we have a CDI interceptor on the @Incoming methods, but since we need access to the metadata, we need a parameter type that contains the metdata (i.e. we cannot support Record<String, Fruit> or Fruit as parameter types).

mrickly avatar Jul 18 '22 15:07 mrickly

Initial implementation by #1856, to improve if in need

ozangunalp avatar Nov 09 '22 14:11 ozangunalp