title: Convert JSON message to javax.jms.ObjectMessage in ActiveMq
body: <p>I have an ActimeMQ consumer which expects a message in javax.jms.ObjectMessage format. 
  This message pojo has 5 string elements. </p>
  
  <p>Now I am trying to write a message producer for this consumer in NodeJs. 
  I am using <a href="https://github.com/gdaws/node-stomp" rel="nofollow noreferrer">stompit</a> module</p>
  
  <p>My current NodeJs code is </p>
  
  <pre><code>stompit.connect(connectOptions, function(error, client) {
  
  if (error) {
      console.log('connect error ' + error.message);
      return;
  } else {
      console.log("connected");
  }
  
  var sendHeaders = {
      'destination': '/queue/test',
  
      'transformation': 'jms-object-json'
  };
  var msg = new Object();
  msg.val1 = "12";
  msg.val2 = "test";
  msg.val3 = "1";
  msg.val4 = "1";
  msg.val5 = "Y";
  var frame = client.send(sendHeaders);
  frame.write(JSON.stringify(msg));
  frame.end();
  </code></pre>
  
  <p>});
   Java consumer is able to get the message but throws the exception </p>
  
  <blockquote>
    <p>org.apache.activemq.command.ActiveMQTextMessage cannot be cast to javax.jms.ObjectMessage</p>
  </blockquote>
  
  <p>I have read this <a href="http://activemq.apache.org/stomp.html" rel="nofollow noreferrer">page</a> from activeMQ which says that </p>
  
  <blockquote>
    <p>Currently, ActiveMQ comes with a transformer that can transform XML/JSON text to Java objects, but you can add your own transformers as well</p>
  </blockquote>
  
  <p>I didn't quite understand this part on how to convert data. </p>
  
  <p>I have added xstream-1.4.10.jar and jettison-1.3.8.jar in apache-activemq-5.15.0\lib and restarted the ActiveMq server. 
  But still I get the error in the consumer. 
  Also in the ActiveMQ console -> Queues -> message properties, it shows transformation-error</p>
  
  <p>Please let me know how I can convert this ActiveMQTextMessage type to javax.jms.ObjectMessage before it reaches the consumer </p>