<font size=2 face="sans-serif">Thank you Matej, <br>
<br>
I will report this info back to my client, hopefully they will be satisfied
with this answer. <br>
<br>
Best regards<br>
Benjamin</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Matej Novotny &lt;manovotn@redhat.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Takayuki T Ishii &lt;EBB0F3L@jp.ibm.com&gt;,
weld-dev@lists.jboss.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">28/01/2020 15:03</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">[EXTERNAL] Re:
[weld-dev] Question about conversations scope initilization &nbsp; &nbsp;
&nbsp; &nbsp;obeserver</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Hello,<br>
<br>
I think I know what is the &quot;problem&quot; here.<br>
Weld uses lazy conversation init - that means we don't activate context
until you try and access a conversation scoped bean.<br>
<br>
Now, in your example, the ConversationBean tries to begin() a conversation,
then calls the bean (which initializes the context and notifies the observer).<br>
However, in the situation where you try and pass in a non-existing conversation,
the invocation to conversation.begin()[1] will blow up with NonExistingConversationException
and<br>
you will jump right into the catch block[2] where you begin a conversation
with given ID, but you no longer invoke the bean, hence the context won't
get activated.<br>
Try adding the `bean.getMsg()` call to the catch block and see if that
helps.<br>
<br>
Note that CDI spec sets no requirements on how/when to activate the conversation
context, so the lazy behaviour is compliant with spec (and this is also
why you saw no such test in TCKs).<br>
<br>
Regards<br>
Matej<br>
<br>
_________________________________________________________________________________<br>
[1] </font></tt><a href="https://gist.github.com/manovotn/b9e9fde25ab77b5e481d5b34edf02b0c#file-conversationbean-java-L4"><tt><font size=2>https://gist.github.com/manovotn/b9e9fde25ab77b5e481d5b34edf02b0c#file-conversationbean-java-L4</font></tt></a><tt><font size=2>
<br>
[2] </font></tt><a href="https://gist.github.com/manovotn/b9e9fde25ab77b5e481d5b34edf02b0c#file-conversationbean-java-L10-L16"><tt><font size=2>https://gist.github.com/manovotn/b9e9fde25ab77b5e481d5b34edf02b0c#file-conversationbean-java-L10-L16</font></tt></a><tt><font size=2>
<br>
<br>
<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Benjamin Confino&quot; &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; To: &quot;Matej Novotny&quot; &lt;manovotn@redhat.com&gt;<br>
&gt; Cc: &quot;Takayuki T Ishii&quot; &lt;EBB0F3L@jp.ibm.com&gt;, weld-dev@lists.jboss.org<br>
&gt; Sent: Tuesday, January 28, 2020 12:06:14 PM<br>
&gt; Subject: RE: [weld-dev] Question about conversations scope initilization
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
obeserver<br>
&gt; <br>
&gt; Hello<br>
&gt; <br>
&gt; Thanks for the link. I had a look but I couldn't find any TCK tests<br>
&gt; checking to see if an observer method will catch the new<br>
&gt; ConversationContext being created for the &quot;new transient conversation&quot;.
To<br>
&gt; check if a new conversation was activated I created an entirely fresh<br>
&gt; server and ran the test application on it, the behaviour was the same,
the<br>
&gt; first url I pinged on this new server ended with &quot;cid=&quot;
and the observer<br>
&gt; didn't . Normally I've just been restarting the old server but restarting<br>
&gt; frequently.<br>
&gt; <br>
&gt; I've attached the recreate you requested. it consists of the three
classes<br>
&gt; attached to my previous email as well as a minimal html page. To run
it<br>
&gt; load it onto your server and ping<br>
&gt; </font></tt><a href="http://localhost:9080/ConversationContextTest/index.xhtml"><tt><font size=2>http://localhost:9080/ConversationContextTest/index.xhtml</font></tt></a><tt><font size=2>
&nbsp;to see the<br>
&gt; observer fire, and<br>
&gt; </font></tt><a href="http://localhost:9080/ConversationContextTest/index.xhtml?cid=99999"><tt><font size=2>http://localhost:9080/ConversationContextTest/index.xhtml?cid=99999</font></tt></a><tt><font size=2>
&nbsp;to see<br>
&gt; the observer fail to fire.<br>
&gt; <br>
&gt; Best regards<br>
&gt; Benjamin<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; From: &nbsp; Matej Novotny &lt;manovotn@redhat.com&gt;<br>
&gt; To: &nbsp; &nbsp; Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; Cc: &nbsp; &nbsp; weld-dev@lists.jboss.org, Takayuki T Ishii &lt;EBB0F3L@jp.ibm.com&gt;<br>
&gt; Date: &nbsp; 27/01/2020 11:39<br>
&gt; Subject: &nbsp; &nbsp; &nbsp; &nbsp;[EXTERNAL] Re: [weld-dev] Question
about conversations<br>
&gt; scope initilization &nbsp; &nbsp; obeserver<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Hello,<br>
&gt; <br>
&gt; I'd start by pointing you to CDI TCK as that's a good starting point
to<br>
&gt; see what's covered.<br>
&gt; For your question, that would be this test -<br>
&gt; </font></tt><a href="https://github.com/eclipse-ee4j/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/context/conversation/ClientConversationContextTest.java#L344-L349"><tt><font size=2>https://github.com/eclipse-ee4j/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/context/conversation/ClientConversationContextTest.java#L344-L349</font></tt></a><tt><font size=2><br>
&gt; <br>
&gt; And possibly few more in the same test class.<br>
&gt; <br>
&gt; As for the linked classes - your `ConversationBean` is listening for<br>
&gt; @Initialized event. Can you verify that a new conversation was activated<br>
&gt; for your request instead of verifying that context was activated?<br>
&gt; E.g. check IDs or something along those lines? I suppose that will
hold<br>
&gt; true and in that case it works just as spec requires it to.<br>
&gt; From the top of my head I don't really know how we activate/deactivate<br>
&gt; ConversationContext, I'd need to dig that up, but looking at CDI spec,
it<br>
&gt; doesn't mandate that it is activated every time again and it could
already<br>
&gt; be active for given request.<br>
&gt; Plus from just the classes you linked, I cannot know if you test this
with<br>
&gt; no existing conversation or maybe with some long running one before
you<br>
&gt; try to send a request for non-existing one...and so on.<br>
&gt; So if the above doesn't is not enough to answer your question, then
we're<br>
&gt; going to need a complete reproducer so that we both talk about the
same<br>
&gt; scenario :)<br>
&gt; <br>
&gt; Matej<br>
&gt; <br>
&gt; ----- Original Message -----<br>
&gt; &gt; From: &quot;Benjamin Confino&quot; &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; &gt; To: weld-dev@lists.jboss.org<br>
&gt; &gt; Cc: &quot;Takayuki T Ishii&quot; &lt;EBB0F3L@jp.ibm.com&gt;<br>
&gt; &gt; Sent: Monday, January 27, 2020 11:42:14 AM<br>
&gt; &gt; Subject: [weld-dev] Question about conversations scope initilization<br>
&gt; obeserver<br>
&gt; &gt; <br>
&gt; &gt; Hello<br>
&gt; &gt; <br>
&gt; &gt; I have a customer who's sent me a sample application, I have
attached<br>
&gt; the<br>
&gt; &gt; source to it below.<br>
&gt; &gt; <br>
&gt; &gt; When the customer visits index.xhtml they see the following output:<br>
&gt; &gt; <br>
&gt; &gt; Conversation initialized.<br>
&gt; &gt; Conversation begun. </font></tt><a href="cid:1"><tt><font size=2>cid:1</font></tt></a><tt><font size=2>
, timeout:3600000<br>
&gt; &gt; Conversation destroyed. </font></tt><a href="cid:1"><tt><font size=2>cid:1</font></tt></a><tt><font size=2><br>
&gt; &gt; <br>
&gt; &gt; However when they append &quot;?cdi=&quot; or a non-existnant
identifier like<br>
&gt; &gt; &quot;?cdi=10000&quot; to the url they do not see &quot;Conversation
initialized.&quot;<br>
&gt; &gt; <br>
&gt; &gt; The CDI spec says that: If the propagated conversation cannot
be<br>
&gt; restored,<br>
&gt; &gt; the container must associate the request with a new transient<br>
&gt; conversation<br>
&gt; &gt; and throw an exception of type<br>
&gt; &gt; javax.enterprise.context.NonexistentConversationException.<br>
&gt; &gt; <br>
&gt; &gt; I'm wondering if this should apply here? Or would it only apply
if the<br>
&gt; cid<br>
&gt; &gt; pointed to an existing conversation that could not be restored?
And is<br>
&gt; there<br>
&gt; &gt; anything in the spec that covers this specific situation?<br>
&gt; &gt; <br>
&gt; &gt; Unless stated otherwise above:<br>
&gt; &gt; IBM United Kingdom Limited - Registered in England and Wales
with number<br>
&gt; &gt; 741598.<br>
&gt; &gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6<br>
&gt; 3AU<br>
&gt; &gt; <br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; weld-dev mailing list<br>
&gt; &gt; weld-dev@lists.jboss.org<br>
&gt; &gt; <br>
&gt; </font></tt><a href="https://lists.jboss.org/mailman/listinfo/weld-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/weld-dev</font></tt></a><tt><font size=2><br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Unless stated otherwise above:<br>
&gt; IBM United Kingdom Limited - Registered in England and Wales with
number<br>
&gt; 741598.<br>
&gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
&gt; <br>
<br>
</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br>
</font>