@Override
    public void transform(Message message, DataType fromType, DataType toType) {
        AvroSchema schema = message.getExchange().getProperty(SchemaHelper.CONTENT_SCHEMA, AvroSchema.class);

        if (schema == null) {
            throw new CamelExecutionException("Missing proper avro schema for data type processing", message.getExchange());
        }

        try {
            byte[] marshalled;

            String contentClass = SchemaHelper.resolveContentClass(message.getExchange(), null);
            if (contentClass != null) {
                Class<?> contentType
                        = message.getExchange().getContext().getClassResolver().resolveMandatoryClass(contentClass);
                marshalled = Avro.mapper().writer().forType(contentType).with(schema)
                        .writeValueAsBytes(message.getBody());
            } else {
                marshalled = Avro.mapper().writer().forType(JsonNode.class).with(schema)
                        .writeValueAsBytes(getBodyAsJsonNode(message, schema));
            }

            message.setBody(marshalled);

            message.setHeader(Exchange.CONTENT_TYPE, MimeType.AVRO_BINARY.type());
            message.setHeader(SchemaHelper.CONTENT_SCHEMA, schema.getAvroSchema().getFullName());
        } catch (InvalidPayloadException | IOException | ClassNotFoundException e) {
            throw new CamelExecutionException("Failed to apply Avro binary data type on exchange", message.getExchange(), e);
        }
    }
@Test
    void shouldHandlePojo() throws Exception {
        Exchange exchange = new DefaultExchange(camelContext);

        AvroSchema avroSchema
                = Avro.mapper().schemaFrom(AvroBinaryDataTypeTransformerTest.class.getResourceAsStream("Person.avsc"));
        exchange.setProperty(SchemaHelper.CONTENT_SCHEMA, avroSchema);
        exchange.getMessage().setBody(new Person("Mickey", 20));
        transformer.transform(exchange.getMessage(), DataType.ANY, DataType.ANY);

        JSONAssert.assertEquals("""
                    {"name":"Mickey","age":20}
                """, Json.mapper().writeValueAsString(
                Avro.mapper().reader().with(avroSchema).readTree(exchange.getMessage().getBody(byte[].class))), true);
    }