Hi,
first of all let us take this conversation off the cdi list, as it is a Weld related
question (moving to weld-dev list).
Now to your question(s)...
If you could attach a tiny reproducer, this would probably be resolved within minutes, so
if you can send one, do so please.
Now here's the problem, If I use this annotation on just a
regular method
which I call myself, it DOES NOT work.
This feels like very basic use case do I doubt it isn't working.
What are the classes where you declare these methods?
How to you obtain a reference to the bean which has `doSend` method?
Again, reproducer would make all this very obvious and I could help you quickly :)
@Priority set on it and that works fine. But I've also tried
setting
<interceptors> in beans.xml
@Priority enables in for whole application, while beans.xml for the given bean archive.
And you should not combine both approaches.
Regards
Matej
----- Original Message -----
From: "Michael Remijan" <mjremijan(a)yahoo.com>
To: cdi-dev(a)lists.jboss.org
Sent: Monday, November 14, 2016 5:43:27 AM
Subject: [cdi-dev] Think I found bug with interceptor
Greetings,
I am using:
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>3.0.0.Alpha15</version>
</dependency>
and I think I found a bug with the interceptors. I wanted to ask about it
first before I put it in Jira.
Basically, the interceptor I have defined works great if I annotate a method
called by the CDI container, which in my case is an method observing for an
event. I have an ExceptionRetryInterceptor class and an ExceptionRetry
annotation. If I annotate an observer method like this:
@ExceptionRetry
public void send(
@Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt
) throws MessagingException, IOException {....}
No problem, everything works fine. I can see the interceptor code being
called in my logs.
Now here's the problem, If I use this annotation on just a regular method
which I call myself, it DOES NOT work. So if I refactor the above example so
the annotation is NOT on the observer method called by the container, then
the doSend() method below does NOT get wrapped by the interceptor:
public void send(
@Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt
) throws MessagingException, IOException {
//....
doSend();
}
@ExceptionRetry
public void doSend() {....} // this method does not get wrapped by the
interceptor
I'm trying to figure out why. My ExceptionRetryInterceptor class has a
@Priority set on it and that works fine. But I've also tried setting
<interceptors> in beans.xml but the doSend(){...} method still doesn't get
wrapped.
Any thoughts/help?
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev
Note that for all code provided on this list, the provider licenses the code
under the Apache License, Version 2
(
http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
provided on this list, the provider waives all patent and other intellectual
property rights inherent in such information.