3 Replies Latest reply on Jun 13, 2007 4:11 AM by pmuir

    in an MDB how to get an application scoped component ?

    codelion

      I think what I see is that in the MDB I don't have access to Seam contexts.

      But I'd like to get my server wide settings out of an application scoped Seam component.

      I think I've seen that if I'd declare that component an SFSB and try to get it as EJB3 than I won't get the same instance as if I get it as Seam component. Did I see that correctly?

        • 1. Re: in an MDB how to get an application scoped component ?
          jazir1979


          If you annotate your MDB as a Seam component, using @Name, then you can use bijection, I am doing this in my app. I'm not sure if you will be able to access the Application context. The documentation just says "they do support bijection and some other Seam functionality".

          One issue I had was Seam component MDBs being initialised by JBoss before Seam, and if an MDB has any messages waiting for it from before the app was last shut down, they will fail because Seam isn't initialised yet.

          "codelion" wrote:
          I think what I see is that in the MDB I don't have access to Seam contexts.

          But I'd like to get my server wide settings out of an application scoped Seam component.

          I think I've seen that if I'd declare that component an SFSB and try to get it as EJB3 than I won't get the same instance as if I get it as Seam component. Did I see that correctly?


          • 2. Re: in an MDB how to get an application scoped component ?
            codelion

            Just about the same minute you wrote that I looked at Seam reference section 3.2.5. Message-driven beans, which says what you're quoting. I was figuring the same solution, I'm going to try @Name and injection.

            I think we had the same problem with messages coming to MDBs before Seam is initialized. I'm not sure how we have resolved that, but my thought right now is that they'd retry a bit later, wouldn't they? I guess depends on kind of exception and whether the usual retry counter is on for that message, but that's a guess without deep research.

            • 3. Re: in an MDB how to get an application scoped component ?
              pmuir

              There is a problem with the version of EJB3 in JBoss 4.0.5 - if your MDB isn't JMS then Seam interceptors don't get applied. This is fixed in JBoss 4.2.0 - or you can manually start the Seam lifecycle. Anyway, the way it *should* work is to @Name your MDB, then you get full Seam capabilities (but, no LRCs)