3 Replies Latest reply on May 23, 2007 7:35 PM by shane.bryzak

    Seam+JMS: extracting Java object from ObjectMessage

    dkane

      Dear colleagues,

      I am new to Seam and currently most of all interested in JMS subscription from Seam/AJAX web-page. I have successfully set up a simple JMS client with Seam (according to documentation), that is subscribed to topic and doing alert('Got the message').
      Now I need to process ObjectMessage. The Java object in my JMS message is Properties. I need to extract keys-values from this Properties and make them available in JavaScript on my page.
      Could anyone please provide the instruction how to do that, or relevant chapter in Seam documentation ? So far have not found anything except of " use message.getObject()" - and nothing about that object.

      Many thanks in advance !

        • 1. Re: Seam+JMS: extracting Java object from ObjectMessage
          dkane

          No way ?

          I could of course serialize Object to string and use TextMessage instead. But there are some other subscribers already targeted to ObjectMessage.

          • 2. Re: Seam+JMS: extracting Java object from ObjectMessage
            jazir1979

            Hi,

            From what I've seen, the object in your ObjectMessage should follow the same rules as what any Seam Remoting @WebRemote method would return (Section 19.6 of the doco) -- ie: keep it as a simple JavaBean so you can access the serialized state from javascript using properties. I don't think a Java Properties object will work. You could use Firebug in firefox to debug the JS and view what Seam is returning inside the Seam.Remoting.ObjectMessage if you really want to try it.

            Also from looking at Seam's remote.js, I think you call ".value" or "getValue()" on the ObjectMessage, not ".object/getObject()" as the documentation says.

            Seam.Remoting.ObjectMessage = function()
            {
             this.value = null;
            
             Seam.Remoting.ObjectMessage.prototype.getValue = function()
             {
             return this.value;
             }
            
             Seam.Remoting.ObjectMessage.prototype.setValue = function(value)
             {
             this.value = value;
             }
            }
            


            Daniel.


            "dkane" wrote:
            No way ?

            I could of course serialize Object to string and use TextMessage instead. But there are some other subscribers already targeted to ObjectMessage.


            • 3. Re: Seam+JMS: extracting Java object from ObjectMessage
              shane.bryzak

              What Daniel said is spot on. I've also fixed the documentation to correctly refer to the getValue() method.