On 1/4/07, Dain Sundstrom <[EMAIL PROTECTED]> wrote:
I was just reading over the commit logs and noticed this patch to the
MDB code.  I'd like to echo everyone else's comments that is is very
high quality work, and I am excited to see that MDBs deploy now.  I
have some specific comments below...


> ======================================================================
> ========
> --- incubator/openejb/trunk/openejb3/container/openejb-core/src/
> main/java/org/apache/openejb/core/CoreDeploymentInfo.java (original)
> +++ incubator/openejb/trunk/openejb3/container/openejb-core/src/
> main/java/org/apache/openejb/core/CoreDeploymentInfo.java Wed Jan
> 3 22:06:16 2007
> @@ -173,6 +177,13 @@
>                  throw new SystemException(e);
>              }
>          }
> +        if (TimedObject.class.isAssignableFrom(beanClass)) {
> +            try {
> +                this.ejbTimeout = beanClass.getMethod("ejbTimeout");
> +            } catch (NoSuchMethodException e) {
> +                throw new IllegalStateException(e);
> +            }
> +        }
>      }

In EJB3 is there an annotation for Timeout?
Yes javax.ejb.Timeout. The timeout functionality is not yet wired in
though. I don't have much of a clue on how to do this and so am hoping
someone else will do it :-).Should a JIRA be opened for that or is
there an existing JIRA?


> +
> +        /**
> +           Only the NOT_SUPPORTED and REQUIRED transaction
> attributes may be used for message-driven
> +           bean message listener methods. The use of the other
> transaction attributes is not meaningful
> +           for message-driven bean message listener methods
> because there is no pre-existing client transaction
> +           context(REQUIRES_NEW, SUPPORTS) and no client to handle
> exceptions (MANDATORY, NEVER).
> +         */
> +        if (componentType.isMessageDriven() && !
> isBeanManagedTransaction && container instanceof
> TransactionContainer) {
> +            if (policy.policyType != policy.NotSupported &&
> policy.policyType != policy.Required) {
> +                if (method.equals(this.ejbTimeout) &&
> policy.policyType == policy.RequiresNew) {
> +                    // do nothing. This is allowed as the timer
> callback method for a message driven bean
> +                    // can also have a transaction policy of
> RequiresNew Sec 5.4.12 of Ejb 3.0 Core Spec
> +                } else {
> +                    throw new OpenEJBException("The transaction
> attribute " + policy.policyToString() + "is not supported for the
> method "
> +                                               + method.getName()
> + " of the Message Driven Bean " + beanClass.getName());
> +                }
> +            }
> +        }

We should add this check to the verifier.  Also it would be helpful
to explicitly say in the exception message that only NotSupported and
Required are allowed.
Ok but I am a bit hazy about how validation takes place. A pointer on
where to look or how validation is done will be nice :). Also it would
be nice if we have a framework for exception handling where we can
give error codes in the exceptions and the messages will be picked up
from a property file or something like that. That way error message
changes won't need code changes


BTW, have you tried sending a message through the container yet?

Yes I have tried a basic case where the onMessage gets called and also
the transaction related interceptor methods. Not yet tried testing
Transaction rollback etc. It will be helpful if we can have the
embedded AMQ service for the Tests as well so that we can start
writing Test cases for the MDB container.

Very good work!
Thanks

-dain



Reply via email to