title: How to serialize the custom object you are sending in JMS template Convert and Send method
body: <p>I am using the below mentioned code to publish into a topic. It is of the format convertAndSend(Destination destination, Object message)</p>
  
  <pre><code>    Event event;
      jmsTemplate.convertAndSend(topic, event); 
  </code></pre>
  
  <p>My current Event interface is something like this, </p>
  
  <pre><code>    public interface Event {
  
      public boolean isEmpty();
  
      public AcEventDatafileTransaction getDatafileTransaction();
  
      public AcEventObjectTransaction getObjectTransaction();
  
      boolean isDatafileTransaction();
  
      boolean isObjectTransaction();
  
      boolean isRdbmsTransaction();
  
      String getTransactionId();
  
      }
  </code></pre>
  
  <p>Its implementation is something like this, </p>
  
  <pre><code>    public class EventPublisherImpl implements Event {
      private final AcTransactionRecord transactionRecord;
      private final Ac ac;
      private final String[] actualTemplates;
      private final String[] curveTemplates;
  
      public AcEventPublisherImpl(final Ac ac, 
                                  final String[] actualTemplates, 
                                  final String[] curveTemplates, 
                                  final AcTransactionRecord acTransactionRecord) {
          this.ac = ac;
          this.transactionRecord = acTransactionRecord;
          this.actualTemplates = actualTemplates;
          this.curveTemplates = curveTemplates;
      }
  
      @Override
      public boolean isEmpty() {
          return transactionRecord.isEmpty();
      }
  
      @Override
      public AcEventDatafileTransaction getDatafileTransaction() {
          if (isDatafileTransaction()) {
            return new AcEventDatafileTransactionPublisherImpl(transactionRecord.getDatafileTransaction());
          }
          return null;
      }
  
  
      @Override
      public AcEventObjectTransaction getObjectTransaction() {
          if (isObjectTransaction()) {
            return new AcEventObjectTransactionPublisherImpl(ac, actualTemplates, curveTemplates, transactionRecord.getObjectOperations());
          }
          return null;
      }
  
      @Override
      public boolean isDatafileTransaction() {
          return transactionRecord.getType() == AcTransactionRecord.DATAFILE_TRANS;
      }
  
      @Override
      public boolean isObjectTransaction() {
          return transactionRecord.getType() == AcTransactionRecord.OBJECT_TRANS;
      }
  
      @Override
      public boolean isRdbmsTransaction() {      
        return transactionRecord.getType() == AcTransactionRecord.RDBMS_TRANS;
      }
  
      @Override
      public String getTransactionId() {
          if (transactionRecord != null) {
              return Integer.toString(transactionRecord.getNumber());
          }
          return "";
      }
    }
  </code></pre>
  
  <p>How do I convert it into a serializable form?</p>
  
  <p>My whole objective is to publish Event object into topic. For that I am using convertAndSend method. That method requires an object of a serialized class, which I currently dont have. It is what I am trying to achieve. 
  I have looked at examples where a class with few attributes is serialized using message converter <a href="https://examples.javacodegeeks.com/enterprise-java/spring/spring-framework-jmstemplate-example/" rel="nofollow noreferrer">https://examples.javacodegeeks.com/enterprise-java/spring/spring-framework-jmstemplate-example/</a></p>
  
  <p>Please suggest a method through code or point to the appropriate example and how that helps me.  </p>