2 Replies Latest reply on Dec 10, 2006 10:39 AM by jasonshaffer

    JavaScript Object Undefined in JMS ObjectMessage Topic Callb

    jasonshaffer

      I am experiencing an object undefined JavaScript error in my client side Seam Remoting topic subscription callback function. The function is executed when expected (when I publish an object message to the topic) but the message object's value property is undefined. I have also tried to use the message's object property which is also undefined. Can anyone point me to the right direction?

      Here is my JavaScript callback function:

      function subscriptionCallback(message) {
       var game = message.getValue();
       alert('Test: ' + game.getDescription());
      }
      


      Here is my server side publishing code:
      private void publish(Game game) {
       try {
       topicPublisher.publish(topicSession.createObjectMessage(game));
       } catch (Exception ex) {
       throw new RuntimeException(ex);
       }
      }
      


      Also, I notice an inconsistency in the chatroom example and the Contextual Components documentation. The chatroom example uses the getValue() method to retrieve the object from the message:
      function channelMessageCallback(message) {
       var ctl = getObject("channelDisplay");
      
       var actionDTO = message.getValue();
      


      but the documentation instructs us to use the getObject() method:

      A TextMessage contains the text value in its text field (or alternatively call getText() on it), while an ObjectMessage contains its object value in its object field (or call its getObject() method).


      Thanks for your advise.
      Jason