クラス RedisMessageSendingTemplate
java.lang.ObjectSE
org.springframework.messaging.core.AbstractMessageSendingTemplate<ChannelTopic>
org.springframework.data.redis.messaging.RedisMessageSendingTemplate
- 実装済みのインターフェース一覧:
RedisMessageSendingOperations, DestinationResolvingMessageSendingOperations<ChannelTopic>, MessageSendingOperations<ChannelTopic>
public class RedisMessageSendingTemplate
extends AbstractMessageSendingTemplate<ChannelTopic>
implements RedisMessageSendingOperations
RedisOperations を介して Redis Pub/ サブチャンネルに公開するためのメッセージ指向テンプレート。 このテンプレートは、Spring Messaging の Message 抽象化と Redis Pub/Sub を橋渡しします。Destinations は TopicResolver を基盤とする DestinationResolver を介して解決され、チャネル名は String serializer を使用して書き込まれます。
基となる RedisOperations の設定済み値シリアライザを使用する RedisOperations.convertAndSend(String, Object) とは対照的に、このテンプレートはペイロード変換を MessageConverter に委譲します。デフォルトのコンバーターは RedisMessageConverters.createMessageConverter() によって作成され、ペイロード型、存在する場合は contentType ヘッダーに応じて適切な変換戦略を選択します。
Redis Pub/Sub は、直列化されたメッセージ本文のみを送信します。メッセージヘッダーは公開前に変換処理に関与し、Redis には書き込まれません。
- 導入:
- 4.1
- 作成者:
- Mark Paluch
- 関連事項:
フィールド概要
クラス AbstractMessageSendingTemplate から継承されたフィールド
CONVERSION_HINT_HEADER, loggerコンストラクター概要
コンストラクター修飾子コンストラクター説明RedisMessageSendingTemplate(RedisOperations<?, ?> redisOperations) 指定されたRedisOperationsの新しいRedisMessageSendingTemplateを作成します。protectedRedisMessageSendingTemplate(RedisOperations<?, ?> redisOperations, RedisSerializer<StringSE> stringSerializer) 方法の概要
修飾子と型メソッド説明<T> voidconvertAndSend(StringSE destinationName, T payload) <T> voidconvertAndSend(StringSE destinationName, T payload, @Nullable MapSE<StringSE, ObjectSE> headers) <T> voidconvertAndSend(StringSE destinationName, T payload, @Nullable MapSE<StringSE, ObjectSE> headers, @Nullable MessagePostProcessor postProcessor) <T> voidconvertAndSend(StringSE destinationName, T payload, @Nullable MessagePostProcessor postProcessor) protected voiddoSend(ChannelTopic destination, Message<?> message) @Nullable DestinationResolver<ChannelTopic> 構成された宛先リゾルバーを返します。protected final ChannelTopicresolveDestination(StringSE destinationName) voidvoidsetDestinationResolver(@Nullable DestinationResolver<ChannelTopic> destinationResolver) DestinationResolverを構成して、文字列の宛先名を実際のChannelTopic型の宛先に解決するようにします。クラス AbstractMessageSendingTemplate から継承されたメソッド
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, doConvert, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverterクラス ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSEインターフェース MessageSendingOperations から継承されたメソッド
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send, send
コンストラクターの詳細
RedisMessageSendingTemplate
指定されたRedisOperationsの新しいRedisMessageSendingTemplateを作成します。設定済みの文字列
RedisSerializerまたはRedisTemplateが利用可能な場合はそれを使用し、そうでない場合はRedisSerializer.string()にフォールバックしてチャネルの直列化を行います。- パラメーター:
redisOperations- 使用する Redis 操作。null であってはなりません。
RedisMessageSendingTemplate
protected RedisMessageSendingTemplate(RedisOperations<?, ?> redisOperations, RedisSerializer<StringSE> stringSerializer)
方法の詳細
setDestinationResolver
DestinationResolverを構成して、文字列の宛先名を実際のChannelTopic型の宛先に解決するようにします。デフォルトでは、
TopicResolver.channel()をバックエンドとするTopicDestinationResolverが使用されます。宛先名に基づく操作を使用しない場合にのみ、このプロパティを null に設定してください。- パラメーター:
destinationResolver- 使用する宛先リゾルバー。
getDestinationResolver
構成された宛先リゾルバーを返します。- 戻り値:
- 設定された宛先リゾルバー。
send
- 次で指定:
- インターフェース
DestinationResolvingMessageSendingOperations<ChannelTopic>内のsend - 例外:
MessagingException
convertAndSend
- 次で指定:
- インターフェース
DestinationResolvingMessageSendingOperations<ChannelTopic>内のconvertAndSend - 例外:
MessagingException
convertAndSend
public <T> void convertAndSend(StringSE destinationName, T payload, @Nullable MapSE<StringSE, ObjectSE> headers) throws MessagingException- 次で指定:
- インターフェース
DestinationResolvingMessageSendingOperations<ChannelTopic>内のconvertAndSend - 例外:
MessagingException
convertAndSend
public <T> void convertAndSend(StringSE destinationName, T payload, @Nullable MessagePostProcessor postProcessor) throws MessagingException - 次で指定:
- インターフェース
DestinationResolvingMessageSendingOperations<ChannelTopic>内のconvertAndSend - 例外:
MessagingException
convertAndSend
public <T> void convertAndSend(StringSE destinationName, T payload, @Nullable MapSE<StringSE, ObjectSE> headers, @Nullable MessagePostProcessor postProcessor) throws MessagingException- 次で指定:
- インターフェース
DestinationResolvingMessageSendingOperations<ChannelTopic>内のconvertAndSend - 例外:
MessagingException
doSend
- 次で指定:
- クラス
AbstractMessageSendingTemplate<ChannelTopic>のdoSend
resolveDestination