Description
Expected Behavior
I'm using a Spring Cloud Steam ListenerContainerCustomizer
to customize a AbstractMessageListenerContainer
in order to add a record interceptor. I would expect to be able to add a record interceptor at the last position, or to be able to get the current record interceptor, create a CompositeRecordInterceptor
to do the same thing and then set it (either is fine).
Current Behavior
The issue I have is that only setRecordInterceptor(...)
is public, not getRecordInterceptor()
and there is no addRecordInterceptor(...)
either. I would like to keep the existing record interceptors there and just add mine in last position but there seem to be no easy way to do this.
Context
I have a code similar to this:
@Bean
public ListenerContainerCustomizer<AbstractMessageListenerContainer<byte[], byte[]>> listenerContainerCustomizer() {
return (container, destinationName, group) -> container.setRecordInterceptor(new MyRecordInterceptor());
}
That I want to use in a small company internal library, but I don't want to remove the other projects the ability to use their own record interceptors.
I tried to use Spring Cloud Steam ChannelInterceptor
(with GlobalChannelInterceptor
) to achieve the thing I wanted, but they call afterSendCompletion(...)
after each attempts, while the record interceptor afterRecord(...)
is called after all attempts. Also they do not allow to modify headers.