class AMQPUtils {

    public static FlowFile updateFlowFileAttributesWithAmqpProperties(BasicProperties amqpProperties, FlowFile flowFile, ProcessSession processSession) {
        if (amqpProperties != null) {
            try {
                Method[] methods = BasicProperties.class.getDeclaredMethods();
                Map<String, String> attributes = new HashMap<>();
                for (Method method : methods) {
                    if (Modifier.isPublic(method.getModifiers()) && method.getName().startsWith("get")) {
                        Object amqpPropertyValue = method.invoke(amqpProperties);
                        if (amqpPropertyValue != null) {
                            String propertyName = extractPropertyNameFromMethod(method);
                            if (isValidAmqpPropertyName(propertyName)) {
                                if (propertyName.equals(PropertyNames.CONTENT_TYPE.getValue())) {
                                    attributes.put(CoreAttributes.MIME_TYPE.key(), amqpPropertyValue.toString());
                                }
                                attributes.put(propertyName, amqpPropertyValue.toString());
                            }
                        }
                    }
                }
                flowFile = processSession.putAllAttributes(flowFile, attributes);
            } catch (Exception e) {
                logger.warn("Failed to update FlowFile with AMQP attributes", e);
            }
        }
        return flowFile;
    }

}