Class RedisMessageSendingTemplate

java.lang.Object
org.springframework.messaging.core.AbstractMessageSendingTemplate<ChannelTopic>
org.springframework.data.redis.messaging.RedisMessageSendingTemplate
All Implemented Interfaces:
RedisMessageSendingOperations, DestinationResolvingMessageSendingOperations<ChannelTopic>, MessageSendingOperations<ChannelTopic>

public class RedisMessageSendingTemplate extends AbstractMessageSendingTemplate<ChannelTopic> implements RedisMessageSendingOperations
Message-oriented template for publishing to Redis Pub/Sub channels through RedisOperations.

This template bridges Spring Messaging's Message abstraction to Redis Pub/Sub. Destinations are resolved through a DestinationResolver backed by a TopicResolver, and channel names are written by using a String serializer.

In contrast to RedisOperations.convertAndSend(String, Object), which uses the configured value serializer of the underlying RedisOperations, this template delegates payload conversion to a MessageConverter. The default converter is created through RedisMessageConverters.createMessageConverter() and selects a suitable conversion strategy according to the payload type and, if present, the contentType header.

Redis Pub/Sub transmits only the serialized message body. Message headers participate in conversion before publication and are not written to Redis.

Since:
4.1
Author:
Mark Paluch
See Also: