yes.
  but you need to implement the serializable interface for the object which
is sent to consumer.
  code example:
 
 /*the object you will be sent to consumer*/
  public class MSObject implements java.io.Serializable{
  ......
  }

  /*sending method*/
  private void sendObjectMessage() throws Exception {
                ActiveMQSession mysession = (ActiveMQSession) session;
                ObjectMessage msg = session.createObjectMessage();
                msg.setObject( new MSObject("first name","Jimmy") );
                msg.setJMSType(this.CMD_TYPE_MESSAGETYPE_OBJECT);
                producer.send(msg);
                if (transacted) {
                        session.commit();
                }
                System.out.println("The object message has been sent to " + 
this.subject
                                + " queue.");
                Thread.sleep(sleepTime);
        }
    /*receiving method
    public void onMessage(Message message) {
    ......
        if (message instanceof ObjectMessage) {
                System.out.println("recevied a Object Message");
                ObjectMessage msg = (ObjectMessage)message;
                MSObject obj = (MSObject)msg.getObject();
                System.out.println("info: ");
                System.out.println("key: "+obj.getKey());
                System.out.println("value: "+obj.getValue());
        }
    }
        FYI,good luck! :)


manish_goyal wrote:
> 
> Hi,
> 
> I am using Java application to send a JAVA Object to ActiveMQ JMS queue. 
> Is this possible to send ?
> 
> I m using following method to send JAVA Object but it's not accepting JAVA
> object.
> producer.send(session.createObjectMessage(java_object));
> 
> Please clarify this issue ASAP or give some pointer to solve this issue.
> 
> Thanks.
> 
> Regards,
> Manish 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can-we-send-a-JAVA-object-to-ActiveMQ-JMS-Queue-tp20415514p20435476.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to