3 Replies Latest reply on Dec 16, 2010 12:04 AM by Matthew Browne

    Simplest approach to messaging - JMS?

    Matthew Browne Newbie

      Hi,
      I am looking for some general advice as to what messaging solution would be simplest for my situation...


      I am developing an application in Seam that needs to be able to talk to a separate process, currently on the same machine (although that could change in the future). It has to be in a separate process because its purpose is to generate music files and I'm running it from within MaxMSP, a musical programming environment, which allows you to run your own Java code within it.


      I only need to be able to send simple commands back and forth between the two processes...I thought of just using sockets, and perhaps that would be the best approach, but I'd prefer to be working at a higher level of abstraction.


      I tried using JBoss Remoting, and in fact I spent a lot of time on this and got it working well with a standalone Java test app, but unfortunately when I tried to run it from within Seam it no longer worked. When the invoke() method was called, I was getting an end of file error message that I found impossible to debug, with no help at all from the Jboss Remoting forum (the lack of support also concerns me). I tried using the rmi:// protocol instead of socket:// but that didn't work with MaxMSP due to classloader issues... so I'm very ready to try something other than JBoss Remoting. I'm using Jboss AS 5.1.


      Would JMS perhaps be a better option? I'm a little hesitant to try it because I haven't used it before, and I'm concerned that it would add unnecessary overhead and complexity to the project. I am following the Seam in Action book which recommends the use of POJOs for simplicity, and it looks like in order to use JMS you have to be using EJBs instead. I'd rather not significantly increase the complexity of my project (and lose some of the hot-deploy features) just to get messaging working.


      This seems to be a simple problem but I've found it to be surprisingly difficult to figure out...of course I'm still relatively new to Java web programming...I really like Seam so whatever way this works most easily with Seam is the method I want to pursue.


      Thanks for any help or suggestions,
      Matt

        • 1. Re: Simplest approach to messaging - JMS?
          Hui Onn Tan Newbie

          Regarding JBoss Remoting, I have no experience on it and hence no comment. But I am using JBoss Netty for socket programming with Seam. Netty is very easy to learn and use (learning from the samples it provides). I use it for synchronous point-to-point communication.


          I think classloader issue with RMI can be solved with certain configuration. I did it recently. But your problem can be different. I also use it for synchronous point-to-point communication.



          I use also JMS without (session) EJB. It works for JBoss AS and Weblogic but not working in Websphere (Websphere disallows TopicSubscriber.setMessageListener, etc even in web application). Regarding complexity, it does increase the complexity as you need to deploy/install JMS in the application server but I still use it for its subscribe/publish messaging model.


          In conclusion, you need to choose the technology that can solve your problem most easily.

          • 2. Re: Simplest approach to messaging - JMS?
            Leo van den berg Master

            Hi,


            have a look at RestEasy (the simple webservice), because it supports not only the server part but also has a client framework available. The nice thing is that it is quite simple and you inteact between processes with meaningful URLs. I already used it together with a Jetty server to run a client part.


            JMS is feasible, but is a bit too heavy to do simple remoting (because you need the JMS service9, so at the moment you externalize your process, it gets complex. Seams support for JMS-POJO is not great (thre are different requests to get it at the Spring-level of simplicity, but nothing happening there).


            Leo


            • 3. Re: Simplest approach to messaging - JMS?
              Matthew Browne Newbie

              Thank you so much for the responses, this gives me some new avenues to try...I'm sure one of those options will work. This confirms my suspicion that JMS is probably overkill for my needs. Thanks again.