adapt

fun <T> adapt(message: Mqtt3Publish, targetType: Class<T>): T

Converts the given message into the expected targetType.

fun adapt(payload: Any): ByteArray

Converts the given payload into a ByteArray.

Strings and primitives are converted directly, other types are serialized to json.