Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the support of KafkaListeners #146

Open
mamdouni opened this issue Mar 7, 2023 · 3 comments
Open

Add the support of KafkaListeners #146

mamdouni opened this issue Mar 7, 2023 · 3 comments

Comments

@mamdouni
Copy link
Collaborator

mamdouni commented Mar 7, 2023

For the moment, i'm using the same method for for the main and retry topic
image
if i run a somple kafka test like below :
image
i'm having this error :
org.awaitility.core.ConditionTimeoutException: Condition with com.decathlon.tzatziki.kafka.KafkaInterceptor was not fulfilled within 10 seconds.
After debugging, i found that the issue came from this code bloc from the KafkaInterceptor class (which is not executed):
image
Actually, it's normal. As this annotation checks only the KafkaListener annotation and by declaring multiple ones on the same method -> a KafkaListeners annotation will be added (after compilation) to englobe them
for example :

public @interface Foos {
    Foo[] value();
}

// pre Java 8
@Foos({@Foo(bar="one"), @Foo(bar="two")})
public void haha() {}

// post Java 8 with @Repeatable(Foos.class) on @Foo
@Foo(bar="one") @Foo(bar="two")
public void haha() {}

source : https://stackoverflow.com/questions/1554112/multiple-annotations-of-the-same-type-on-one-element
To resolve the issue, we have to add an aspect to intercept the KafkaListeners calls also

@brian-mulier
Copy link
Collaborator

Hello !
I can see the issue.
As a workaround maybe you can create two methods which call the same private method in the end ? (watch out for @transactional which should be duplicate on both entry method to work since it doesn't work when calling private method).

If it is really annoying feel free to contribute :)

@mamdouni
Copy link
Collaborator Author

mamdouni commented Mar 7, 2023

Yes,
For the moment, that's what i will do and thanks for the hint (i totally forget get, it's the same bean)
Ok, i will create the Pull Request

@mimfgg
Copy link
Collaborator

mimfgg commented May 30, 2023

Hi @mamdouni should we still implement this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants