ByteBuddy AgentBuilder Problems setting a Hook to KafkaListenerContainerFactory
I am trying to set a method Hook to KafkaListenerContainerFactory.KafkaListenerContainerFactory() I am having problems defining the method signature and always get the error:
java.lang.IllegalArgumentException: None of [private static net.bytebuddy.dynamic.DynamicType$Builder com.bionicstork.analysis.hooks.KafkaListenerAnnotationBeanPostProcessorHook.lambda$install$0(net.bytebuddy.dynamic.DynamicType$Builder,net.bytebuddy.description.type.TypeDescription,java.lang.ClassLoader,net.bytebuddy.utility.JavaModule), public static java.lang.Object com.bionicstork.analysis.hooks.KafkaListenerAnnotationBeanPostProcessorHook.createListenerContainer(java.lang.Object,java.util.concurrent.Callable) throws java.lang.Exception, INSTANCE] allows for delegation from public abstract org.springframework.kafka.listener.MessageListenerContainer org.springframework.kafka.config.KafkaListenerContainerFactory.createListenerContainer(org.springframework.kafka.config.KafkaListenerEndpoint)
My code is:
public class KafkaListenerAnnotationBeanPostProcessorHook {
private static final Logger logger = LoggerFactory.getLogger(KafkaListenerAnnotationBeanPostProcessorHook.class);
@IgnoreForBinding
public static AgentBuilder install(AgentBuilder agentBuilder) {
return agentBuilder.type(named("org.springframework.kafka.config.KafkaListenerContainerFactory"))
.transform((builder, type, classLoader, module) -> builder
.method(named("createListenerContainer"))
.intercept(MethodDelegation.to(KafkaListenerAnnotationBeanPostProcessorHook.class))
);
}
public static org.springframework.context.SmartLifecycle createListenerContainer(Object endPoint,
@SuperCall Callable<?> superMethod) throws Exception {
Comments
Post a Comment