users@javaee-spec.java.net

[javaee-spec users] Feedback from JavaOne talk

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Thu, 11 Oct 2012 15:05:05 +0100

Nigel et al.

Here is a writeup of the notes I made during Nigel's JavaOne talk on JMS 2.

1) The word "Context" in the simplified API JMSContext seems redundant to me, and not very consistent with usage in other specs. I just wonder if there is a better name for this class (but I don't have one!).

2) Some feedback for the CDI community comes from the way that JMS wants a "gracefully degrading scope" such that @TransactionScoped is used if a transaction is in progress, otherwise a request scoped is used. I would hope to specify this idea in CDI 2.0, hopefully in a way that JMS can then use (as opposed to specifying it directly)

3) Nigel introduced the new simplified method of getting hold of the payload via the receivePayload methods which return the payload already cast to the correct type, using generic inference, however highlighted that this didn't help if you still wanted to look at the message headers, and that here you still need to receive a Message. I suggested adding generic inference to ObjectMessage.getObject for this purpose.

4) JMS 2 code, with CDI, has a lot of:

@Inject
@JMSConnectionFactory("foo")
JMSContext ctx;

which concerns me for two reasons:

a) DRY - we constantly repeat the @JMSConnectionFactory("foo") in a fashion that the compiler can't verify (easy to slip in a typo on foo), and that won't be auto-completed in an IDE.
b) that JMSConnectionFactory is actually metadata that is used to determine how JMSContext is wired up, and not configuration for the JMSContext

(b) is a situation I've seen a few times with CDI integrations, and perhaps something CDI needs to address better itself. I'll work with the CDI community on this.

(a) should be addressed by something like a CDI stereotype, however stereotypes are not currently applied to injection points. I'll work with the CDI community + Java EE community on this (this is also an open issue for Java EE 7 - generalizing the notion of stereotypes).