Topic
6 replies Latest Post - ‏2012-01-24T20:22:26Z by P1F4_Matt_Madhavan
deepwater
deepwater
3 Posts
ACCEPTED ANSWER

Pinned topic Anyone have code example - jms client OSGi app?

‏2011-10-17T13:58:36Z |
Does anyone please have a code example of using jms client mode to pull messages implemented as an OSGi application?
Updated on 2012-01-24T20:22:26Z at 2012-01-24T20:22:26Z by P1F4_Matt_Madhavan
  • MarkN
    MarkN
    124 Posts
    ACCEPTED ANSWER

    Re: Anyone have code example - jms client OSGi app?

    ‏2011-10-17T16:19:23Z  in response to deepwater
    Hello,
    We don't have a nicely packaged sample that shows a JMS client working in an OSGi application, although several of our test applications do test this sort of thing. How far have you got? Are you stuck at a particular point?

    Regards,
    Mark
    • deepwater
      deepwater
      3 Posts
      ACCEPTED ANSWER

      Re: Anyone have code example - jms client OSGi app?

      ‏2011-10-17T21:55:47Z  in response to MarkN
      First, thank you very much for your response. We have are just at the point that we have decided how we want to do it based on the WAS 8.0 InfoCenter doc.

      We have been looking for example code of what we can do in client mode within an OSGi application but have not seen any yet.

      What we need to do is interact with WebSphere MQ as an external messaging provider (in client mode as it will be on a different system) in order to pull messages to process. We want our entire app to be OSGi so it looks like we can't have an activation specification as that is not listed in the InfoCenter as one of the things an OSGi app can do. Thank you for any code snippets or suggestions you can offer.
      • MarkN
        MarkN
        124 Posts
        ACCEPTED ANSWER

        Re: Anyone have code example - jms client OSGi app?

        ‏2011-10-18T14:18:34Z  in response to deepwater
        Hello,
        Given that OSGi Applications can't contain MDBs in version 8.0, and that you want to build a pure OSGi application, I think you have two main options.

        The first option would be to use SCA to drive JMS messages straight into the OSGi Application using the SCA JMS Binding. The would be no JMS-specific code in your application, beyond the arrival of a javax.jms.Message object at the OSGi application.

        The second option would be to use Asynchronous Beans. You should be able to write a blueprint bean that exposes an AlarmListener which you could then have the WorkManager drive every five to second seconds. At that point your application would need to go through the standard JMS client cycle of establishing a Connection, opening a Session and polling for JMS messages.

        I hope that one of these two approaches will work for you.

        Regards,
        Mark
        • MarkN
          MarkN
          124 Posts
          ACCEPTED ANSWER

          Re: Anyone have code example - jms client OSGi app?

          ‏2011-10-18T21:05:20Z  in response to MarkN
          By the way, for the SCA option, please see this forum thread. Steve Kinder and I posted some notes on January 19th which you might well find helpful.

          Regards,
          Mark
          • deepwater
            deepwater
            3 Posts
            ACCEPTED ANSWER

            Re: Anyone have code example - jms client OSGi app?

            ‏2011-10-19T15:06:13Z  in response to MarkN
            Thank you much Mark.
            • P1F4_Matt_Madhavan
              P1F4_Matt_Madhavan
              16 Posts
              ACCEPTED ANSWER

              Re: Anyone have code example - jms client OSGi app?

              ‏2012-01-24T20:22:26Z  in response to deepwater
              Hi Deepwater,
              Another (I would say preferable) option would be to use Apache Camel. Lot nicer, cleaner and comes with enormous flexibility.

              If you are interested I can share my code sample!

              Thanks
              Matt