[weld-dev] Question about conversations scope initilization obeserver

Matej Novotny manovotn at redhat.com
Mon Jan 27 06:39:26 EST 2020


Hello,

I'd start by pointing you to CDI TCK as that's a good starting point to see what's covered.
For your question, that would be this test - https://github.com/eclipse-ee4j/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/context/conversation/ClientConversationContextTest.java#L344-L349
And possibly few more in the same test class.

As for the linked classes - your `ConversationBean` is listening for @Initialized event. Can you verify that a new conversation was activated for your request instead of verifying that context was activated?
E.g. check IDs or something along those lines? I suppose that will hold true and in that case it works just as spec requires it to.
>From the top of my head I don't really know how we activate/deactivate ConversationContext, I'd need to dig that up, but looking at CDI spec, it doesn't mandate that it is activated every time again and it could already be active for given request.
Plus from just the classes you linked, I cannot know if you test this with no existing conversation or maybe with some long running one before you try to send a request for non-existing one...and so on.
So if the above doesn't is not enough to answer your question, then we're going to need a complete reproducer so that we both talk about the same scenario :)

Matej

----- Original Message -----
> From: "Benjamin Confino" <BENJAMIC at uk.ibm.com>
> To: weld-dev at lists.jboss.org
> Cc: "Takayuki T Ishii" <EBB0F3L at jp.ibm.com>
> Sent: Monday, January 27, 2020 11:42:14 AM
> Subject: [weld-dev] Question about conversations scope initilization	obeserver
> 
> Hello
> 
> I have a customer who's sent me a sample application, I have attached the
> source to it below.
> 
> When the customer visits index.xhtml they see the following output:
> 
> Conversation initialized.
> Conversation begun. cid:1 , timeout:3600000
> Conversation destroyed. cid:1
> 
> However when they append "?cdi=" or a non-existnant identifier like
> "?cdi=10000" to the url they do not see "Conversation initialized."
> 
> The CDI spec says that: If the propagated conversation cannot be restored,
> the container must associate the request with a new transient conversation
> and throw an exception of type
> javax.enterprise.context.NonexistentConversationException.
> 
> I'm wondering if this should apply here? Or would it only apply if the cid
> pointed to an existing conversation that could not be restored? And is there
> anything in the spec that covers this specific situation?
> 
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev


More information about the weld-dev mailing list