How to serialize and deserialize a Java object in TIBCO ActiveMatrix BusinessWorks.

How to serialize and deserialize a Java object in TIBCO ActiveMatrix BusinessWorks.

book

Article ID: KB0072364

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

When sending a Java object using a JMS Queue Sender, how to serialize the object and at receiving end, how to deserialize it and convert the object to XML.

 

Resolution

Follow the steps below to achieve this:

1). Use a Binary type message when sending/receiving JMS message.
2). Use Java code to serialize and deserialize a Java object.
 

Example:

At the sender side:
************************************************************
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream(baos);
         oos.writeObject(obj);
         setobjBinary(baos.toByteArray());
************************************************************

At the receiver side:
************************************************************
java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(getobjBinary());
java.io.ObjectInputStream ois = new java.io.ObjectInputStream(bais);
setobj(ois.readObject());
************************************************************

Refer to the attached project (Filename: SUPPORT_testBMO.zip) for more information.

Issue/Introduction

How to serialize and deserialize a Java object in TIBCO ActiveMatrix BusinessWorks.

Attachments

How to serialize and deserialize a Java object in TIBCO ActiveMatrix BusinessWorks. get_app