You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Lars-Fredrik Smedberg <it...@gmail.com> on 2014/11/07 15:00:58 UTC

Question on CDI Interceptor and EJBs

Hi!

I tried to create a CDI Interceptor where the @Interceptor class defines
@AroundInvoke and @AroundTimeout methods and then I tried to annotate:

1. The onMessage method of an MDB AND
2. The timeout (@Schedule annotated method) method of an EJB timer

The CDI Interceptor is not invoked.

If I instead use an EJB Inteceptor it is invoked in both cases above.

Questions:

1. I have only tried this in WebSphere so far. Is this out of spec or
something that should be bugreported (does it work in TomEE)?
2. My reason for using CDI Interceptors is that I can separate the
@InterceptorBinding annotation from the @Interceptor implementation class.
This way there is only a compile time dependency to the @InterceptorBinding
annotation. Is there a way to accomplish the same using EJB?

Regards
Lars-Fredrik



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Question on CDI Interceptor and EJBs

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2014-11-07 14:18 GMT+00:00 Lars-Fredrik Smedberg <it...@gmail.com>:
> @Romain
>
> We use TomEE for development but still WebSphere for production :)
>

I understood and that's exactly why I said it ;)

> I will try out my question on TomEE and let you know... thanks anyway for
> taking time to answer :)
>
> /LF
>
> On Fri, Nov 7, 2014 at 3:15 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
>> 2014-11-07 14:00 GMT+00:00 Lars-Fredrik Smedberg <it...@gmail.com>:
>> > Hi!
>> >
>>
>> Hi
>>
>>
>> > I tried to create a CDI Interceptor where the @Interceptor class defines
>> > @AroundInvoke and @AroundTimeout methods and then I tried to annotate:
>> >
>> > 1. The onMessage method of an MDB AND
>> > 2. The timeout (@Schedule annotated method) method of an EJB timer
>> >
>> > The CDI Interceptor is not invoked.
>> >
>> > If I instead use an EJB Inteceptor it is invoked in both cases above.
>> >
>> > Questions:
>> >
>> > 1. I have only tried this in WebSphere so far. Is this out of spec or
>> > something that should be bugreported (does it work in TomEE)?
>>
>>
>> Then this is the wrong list ;)
>>
>> Side note/thought: most of your question are WAS related so I think
>> you should think to either $$ more IBM to get better support or just
>> move to TomEE.
>>
>> > 2. My reason for using CDI Interceptors is that I can separate the
>> > @InterceptorBinding annotation from the @Interceptor implementation
>> class.
>> > This way there is only a compile time dependency to the
>> @InterceptorBinding
>> > annotation. Is there a way to accomplish the same using EJB?
>> >
>>
>> CDI interceptors should work as well, didn't check in TomEE but if not
>> that's a bug.
>>
>> > Regards
>> > Lars-Fredrik
>> >
>> >
>> >
>> > --
>> > Med vänlig hälsning / Best regards
>> >
>> > Lars-Fredrik Smedberg
>> >
>> > STATEMENT OF CONFIDENTIALITY:
>> > The information contained in this electronic message and any
>> > attachments to this message are intended for the exclusive use of the
>> > address(es) and may contain confidential or privileged information. If
>> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
>> > immediately at itsmeden@gmail.com, and destroy all copies of this
>> > message and any attachments.
>>
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.

Re: Question on CDI Interceptor and EJBs

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
@Romain

We use TomEE for development but still WebSphere for production :)

I will try out my question on TomEE and let you know... thanks anyway for
taking time to answer :)

/LF

On Fri, Nov 7, 2014 at 3:15 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> 2014-11-07 14:00 GMT+00:00 Lars-Fredrik Smedberg <it...@gmail.com>:
> > Hi!
> >
>
> Hi
>
>
> > I tried to create a CDI Interceptor where the @Interceptor class defines
> > @AroundInvoke and @AroundTimeout methods and then I tried to annotate:
> >
> > 1. The onMessage method of an MDB AND
> > 2. The timeout (@Schedule annotated method) method of an EJB timer
> >
> > The CDI Interceptor is not invoked.
> >
> > If I instead use an EJB Inteceptor it is invoked in both cases above.
> >
> > Questions:
> >
> > 1. I have only tried this in WebSphere so far. Is this out of spec or
> > something that should be bugreported (does it work in TomEE)?
>
>
> Then this is the wrong list ;)
>
> Side note/thought: most of your question are WAS related so I think
> you should think to either $$ more IBM to get better support or just
> move to TomEE.
>
> > 2. My reason for using CDI Interceptors is that I can separate the
> > @InterceptorBinding annotation from the @Interceptor implementation
> class.
> > This way there is only a compile time dependency to the
> @InterceptorBinding
> > annotation. Is there a way to accomplish the same using EJB?
> >
>
> CDI interceptors should work as well, didn't check in TomEE but if not
> that's a bug.
>
> > Regards
> > Lars-Fredrik
> >
> >
> >
> > --
> > Med vänlig hälsning / Best regards
> >
> > Lars-Fredrik Smedberg
> >
> > STATEMENT OF CONFIDENTIALITY:
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > address(es) and may contain confidential or privileged information. If
> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > immediately at itsmeden@gmail.com, and destroy all copies of this
> > message and any attachments.
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Question on CDI Interceptor and EJBs

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2014-11-07 14:00 GMT+00:00 Lars-Fredrik Smedberg <it...@gmail.com>:
> Hi!
>

Hi


> I tried to create a CDI Interceptor where the @Interceptor class defines
> @AroundInvoke and @AroundTimeout methods and then I tried to annotate:
>
> 1. The onMessage method of an MDB AND
> 2. The timeout (@Schedule annotated method) method of an EJB timer
>
> The CDI Interceptor is not invoked.
>
> If I instead use an EJB Inteceptor it is invoked in both cases above.
>
> Questions:
>
> 1. I have only tried this in WebSphere so far. Is this out of spec or
> something that should be bugreported (does it work in TomEE)?


Then this is the wrong list ;)

Side note/thought: most of your question are WAS related so I think
you should think to either $$ more IBM to get better support or just
move to TomEE.

> 2. My reason for using CDI Interceptors is that I can separate the
> @InterceptorBinding annotation from the @Interceptor implementation class.
> This way there is only a compile time dependency to the @InterceptorBinding
> annotation. Is there a way to accomplish the same using EJB?
>

CDI interceptors should work as well, didn't check in TomEE but if not
that's a bug.

> Regards
> Lars-Fredrik
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.