All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jashmore.sqs.extensions.registry.MessagePayloadDeserializer Maven / Gradle / Ivy

Go to download

API for building a payload parser that has been serialized via the schema registered in the Spring Cloud Schema Registry

There is a newer version: 7.0.0
Show newest version
package com.jashmore.sqs.extensions.registry;

import com.jashmore.documentation.annotations.ThreadSafe;
import software.amazon.awssdk.services.sqs.model.Message;

/**
 * Used to deserialize the payload of a message into a POJO represented by the given schemas.
 *
 * @param  the type of the schema used to represent the object
 */
@ThreadSafe
@FunctionalInterface
public interface MessagePayloadDeserializer {
    /**
     * Deserialize the message body of the message to the required object type.
     *
     * 

This will take the content of the message body that was serialized in the schema defined in the producer schema * and deserialize it to this consumer's schema, returning the new object. * *

For example, in the producer schema there may have only been a temperature field but in the new consumer schema there * is an internal and external temperature. For this case the new schema would have definitions of how to take the old schema * to produce the new schema, e.g. just put the temperature into the internal temperature and set external temperature as * zero. * * @param message the message to deserialize * @param producerSchema the schema of the payload that was sent by the producer * @param consumerSchema the schema that the consumer can handle * @param clazz the class of the object to deserialize to * @return the deserialized body * @throws MessagePayloadDeserializerException when there was an error deserializing */ Object deserialize(Message message, T producerSchema, T consumerSchema, Class clazz) throws MessagePayloadDeserializerException; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy