Github user michaelandrepearce commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1684
  
    @RaiSaurabh 
    
    look at example methods from
    org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage
    
    I'd image you'd want to encode and decode the 
org.apache.activemq.command.Message during persistence and reload.
    
    ```
       @Override
       public int getPersistSize() {
          checkBuffer();
          return DataConstants.SIZE_INT + internalPersistSize();
       }
    
       private int internalPersistSize() {
          return data.array().length;
       }
    
       @Override
       public void persist(ActiveMQBuffer targetRecord) {
          checkBuffer();
          targetRecord.writeInt(internalPersistSize());
          targetRecord.writeBytes(data.array(), 0, data.array().length );
       }
    
       @Override
       public void reloadPersistence(ActiveMQBuffer record) {
          int size = record.readInt();
          byte[] recordArray = new byte[size];
          record.readBytes(recordArray);
          this.messagePaylodStart = 0; // whatever was persisted will be sent
          this.data = Unpooled.wrappedBuffer(recordArray);
          this.bufferValid = true;
          this.durable = true; // it's coming from the journal, so it's durable
          parseHeaders();
       }
    ```


---

Reply via email to