@SuppressWarnings("removal") // TODO: Remove on Vespa 9
        public boolean encode(Routable obj, DocumentSerializer out) {
            if (!(obj instanceof DocumentMessage)) {
                throw new AssertionError(
                        "Document message factory (" + getClass().getName() + ") registered for incompatible " +
                        "routable type " + obj.getType() + "(" + obj.getClass().getName() + ").");
            }
            DocumentMessage msg = (DocumentMessage)obj;
            out.putByte(null, (byte)(msg.getPriority().getValue())); // TODO: encode default value on Vespa 9
            out.putInt(null, 0); // Ignored load type. 0 is legacy "default" load type ID.
            return doEncode(msg, out);
        }
This method decodes a message from the given deserializer. You are guaranteed to only receive byte buffers
generated by a previous call to {@link #doEncode(DocumentMessage, DocumentSerializer)}.
<p>
This method is NOT exception safe. Return null to signal failure.

@param deserializer The deserializer to use for decoding.
@return The decoded message.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories60.java