<div dir="ltr">I can confirm, in my example for routing events, the BookingBean injected into a BookingMDB and listening Observer class also had to be @RequestScoped.<br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p style="margin:0px;font-size:13px;border-collapse:collapse"><span lang="EN-US" style="font-family:Calibri">Werner </span></p></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Aug 26, 2015 at 2:03 PM, <span dir="ltr"><<a href="mailto:cdi-dev-request@lists.jboss.org" target="_blank">cdi-dev-request@lists.jboss.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Send cdi-dev mailing list submissions to<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:cdi-dev-request@lists.jboss.org">cdi-dev-request@lists.jboss.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:cdi-dev-owner@lists.jboss.org">cdi-dev-owner@lists.jboss.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of cdi-dev digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: JMS 2.1: Proposal to allow any CDI managed bean in a Java<br>
EE application to listen for JMS messages (Nigel Deakin)<br>
2. Re: JMS 2.1: Proposal to allow any CDI managed bean in a Java<br>
EE application to listen for JMS messages (John D. Ament)<br>
<br>
----------------------------------------------------------------------<br>
<br>Message: 2<br>
Date: Wed, 26 Aug 2015 11:10:11 +0000<br>
From: "John D. Ament" <<a href="mailto:john.d.ament@gmail.com">john.d.ament@gmail.com</a>><br>
Subject: Re: [cdi-dev] JMS 2.1: Proposal to allow any CDI managed bean<br>
in a Java EE application to listen for JMS messages<br>
To: Nigel Deakin <<a href="mailto:nigel.deakin@oracle.com">nigel.deakin@oracle.com</a>>, arjan tijms<br>
<<a href="mailto:arjan.tijms@gmail.com">arjan.tijms@gmail.com</a>>, Romain Manni-Bucau <<a href="mailto:rmannibucau@gmail.com">rmannibucau@gmail.com</a>><br>
Cc: cdi-dev <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
Message-ID:<br>
<CAOqetn8LhNvq+4ELzuq-MLA3=6eVP3-k_AMQ8502=<a href="mailto:ag4jy4ZCg@mail.gmail.com">ag4jy4ZCg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
On Wed, Aug 26, 2015 at 6:53 AM Nigel Deakin <<a href="mailto:nigel.deakin@oracle.com">nigel.deakin@oracle.com</a>><br>
wrote:<br>
<br>
> On 26/08/2015 10:51, arjan tijms wrote:<br>
> > On Wed, Aug 26, 2015 at 11:09 AM, Romain Manni-Bucau<br>
> > <<a href="mailto:rmannibucau@gmail.com">rmannibucau@gmail.com</a>> wrote:<br>
> >> Agree for provided scope but JMS + short time scopes will not match<br>
> well in<br>
> >> practise so i would worry more about not "default" scopes which can miss<br>
> >> these events.<br>
> ><br>
> > Short lived scopes like @RequestScoped may not be the best match indeed.<br>
> ><br>
> > Additionally, @RequestScoped is kinda assumed to be an "@ThreadScoped"<br>
> > thing, e.g. there's the expectation that only the current thread will<br>
> > access it. If the JMS provider will asynchronously call a method on<br>
> > the bean instance from another thread, then this breaks this<br>
> > assumption.<br>
><br>
> That's an interesting point. Is there anything in the CDI spec which would<br>
> forbid the use of a @RequestScoped JMS<br>
> listener bean from another thread?<br>
><br>
<br>
The CDI spec still mandates that a request scope is started for delivery to<br>
MDBs. See <a href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#request_context" rel="noreferrer" target="_blank">http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#request_context</a><br>
<br>
The JMS provider would be responsible for retrieving a contextual reference<br>
to the bean and then invoking the method. The container should still be<br>
responsible for starting the request context (If I read this correctly).<br>
<br>
Likewise, we could say that a @TransactionScoped bean also applies here,<br>
since a JTA transaction should have been started by the RA.<br>
<br>
<br>
><br>
> Perhaps all that is needed is to make it clear to users that this is what<br>
> would happen. The same issue would arise if<br>
> the user injected a dependent-scoped JMS listener bean into a<br>
> @RequestScoped bean.<br>
><br>
> It's worth considering threading more generally. Although the JMS provider<br>
> (resource adapter, actually) can make sure<br>
> that the callback method won't be called from multiple JMS provider<br>
> threads at the same time, it can't guarantee that an<br>
> application thread won't be calling a business method on the bean at the<br>
> same time. (Would it want to?)<br>
><br>
> Nigel<br>
> _______________________________________________<br>
> cdi-dev mailing list<br>
> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
><br>
> Note that for all code provided on this list, the provider licenses the<br>
> code under the Apache License, Version 2 (<br>
> <a href="http://www.apache.org/licenses/LICENSE-2.0.html" rel="noreferrer" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas<br>
> provided on this list, the provider waives all patent and other<br>
> intellectual property rights inherent in such information.<br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.jboss.org/pipermail/cdi-dev/attachments/20150826/bb408008/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.jboss.org/pipermail/cdi-dev/attachments/20150826/bb408008/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
<br>
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" rel="noreferrer" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
<br>
End of cdi-dev Digest, Vol 57, Issue 24<br>
***************************************<br>
</blockquote></div><br></div></div>