spring-framework / org.springframework.jms.core / JmsMessageOperations / convertSendAndReceive

convertSendAndReceive

@Nullable abstract fun <T : Any> convertSendAndReceive(destinationName: String, request: Any, targetClass: Class<T>): T

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, send it as a Message to the given destination, receive the reply and convert its body of the specified target class.

Parameters

destinationName - the name of the target destination

request - payload for the request message to send

targetClass - the target type to convert the payload of the reply to

Return
the payload of the reply message, possibly null if the message could not be received, for example due to a timeout

@Nullable abstract fun <T : Any> convertSendAndReceive(destinationName: String, request: Any, @Nullable headers: MutableMap<String, Any>, targetClass: Class<T>): T

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, send it as a Message with the given headers, to the specified destination, receive the reply and convert its body of the specified target class.

Parameters

destinationName - the name of the target destination

request - payload for the request message to send

headers - headers for the request message to send

targetClass - the target type to convert the payload of the reply to

Return
the payload of the reply message, possibly null if the message could not be received, for example due to a timeout

@Nullable abstract fun <T : Any> convertSendAndReceive(destinationName: String, request: Any, targetClass: Class<T>, requestPostProcessor: MessagePostProcessor): T

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, apply the given post processor and send the resulting Message to the given destination, receive the reply and convert its body of the given target class.

Parameters

destinationName - the name of the target destination

request - payload for the request message to send

targetClass - the target type to convert the payload of the reply to

requestPostProcessor - post process to apply to the request message

Return
the payload of the reply message, possibly null if the message could not be received, for example due to a timeout

@Nullable abstract fun <T : Any> convertSendAndReceive(destinationName: String, request: Any, headers: MutableMap<String, Any>, targetClass: Class<T>, requestPostProcessor: MessagePostProcessor): T

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, wrap it as a message with the given headers, apply the given post processor and send the resulting Message to the specified destination, receive the reply and convert its body of the given target class.

Parameters

destinationName - the name of the target destination

request - payload for the request message to send

targetClass - the target type to convert the payload of the reply to

requestPostProcessor - post process to apply to the request message

Return
the payload of the reply message, possibly null if the message could not be received, for example due to a timeout