public class MessageBrokerRegistry
extends java.lang.Object
コンストラクターと説明 |
---|
MessageBrokerRegistry(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel) |
修飾子と型 | メソッドと説明 |
---|---|
ChannelRegistration | configureBrokerChannel() アプリケーションからメッセージブローカーにメッセージを送信するために使用するチャネルをカスタマイズします。 |
SimpleBrokerRegistration | enableSimpleBroker(java.lang.String... destinationPrefixes) シンプルなメッセージブローカーを有効にし、1 つ以上のプレフィックスを設定して、ブローカーをターゲットとする宛先をフィルタリングします(例: |
StompBrokerRelayRegistration | enableStompBrokerRelay(java.lang.String... destinationPrefixes) STOMP ブローカーリレーを有効にし、メッセージブローカーでサポートされる宛先プレフィックスを設定します。 |
protected java.util.Collection<java.lang.String> | getApplicationDestinationPrefixes() |
protected ChannelRegistration | getBrokerChannelRegistration() |
protected PathMatcher | getPathMatcher() |
protected SimpleBrokerMessageHandler | getSimpleBroker(SubscribableChannel brokerChannel) |
protected StompBrokerRelayMessageHandler | getStompBrokerRelay(SubscribableChannel brokerChannel) |
protected java.lang.String | getUserDestinationBroadcast() |
protected java.lang.String | getUserDestinationPrefix() |
protected java.lang.String | getUserRegistryBroadcast() |
protected java.lang.Integer | getUserRegistryOrder() |
MessageBrokerRegistry | setApplicationDestinationPrefixes(java.lang.String... prefixes) 1 つ以上のプレフィックスを設定して、アプリケーションのアノテーション付きメソッドをターゲットとする宛先をフィルタリングします。 |
MessageBrokerRegistry | setCacheLimit(int cacheLimit) ブローカーへの登録に適用するキャッシュ制限を構成します。 |
MessageBrokerRegistry | setPathMatcher(PathMatcher pathMatcher) 受信メッセージの宛先を @MessageMapping および @SubscribeMapping メソッドに一致させるために使用する PathMatcher を構成します。 |
MessageBrokerRegistry | setPreservePublishOrder(boolean preservePublishOrder) クライアントが発行順にメッセージを受信する必要があるかどうか。 |
MessageBrokerRegistry | setUserDestinationPrefix(java.lang.String destinationPrefix) ユーザーの宛先を識別するために使用する接頭辞を構成します。 |
void | setUserRegistryOrder(int order) SmartApplicationListener として使用する SimpUserRegistry の順序を設定します。 |
public MessageBrokerRegistry(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel)
public SimpleBrokerRegistration enableSimpleBroker(java.lang.String... destinationPrefixes)
public StompBrokerRelayRegistration enableStompBrokerRelay(java.lang.String... destinationPrefixes)
public ChannelRegistration configureBrokerChannel()
protected ChannelRegistration getBrokerChannelRegistration()
@Nullable protected java.lang.String getUserDestinationBroadcast()
@Nullable protected java.lang.String getUserRegistryBroadcast()
public MessageBrokerRegistry setApplicationDestinationPrefixes(java.lang.String... prefixes)
メッセージが処理されると、ルックアップパスを形成するために、一致するプレフィックスが宛先から削除されます。つまり、アノテーションには宛先プレフィックスを含めないでください。
末尾にスラッシュがないプレフィックスには、自動的に追加されます。
@Nullable protected java.util.Collection<java.lang.String> getApplicationDestinationPrefixes()
public MessageBrokerRegistry setUserDestinationPrefix(java.lang.String destinationPrefix)
たとえば、ユーザーが "/user/queue/position-updates" にサブスクライブしようとすると、宛先が "/queue/position-updatesi9oqdfzo" に変換され、同じことを試みている他のユーザーと衝突しない一意のキュー名が生成される場合があります。その後、メッセージが "/user/{username}/queue/position-updates", に送信されると、宛先は "/queue/position-updatesi9oqdfzo" に変換されます。
このような宛先を識別するために使用されるデフォルトのプレフィックスは "/user/" です。
@Nullable protected java.lang.String getUserDestinationPrefix()
public void setUserRegistryOrder(int order)
SmartApplicationListener
として使用する SimpUserRegistry
の順序を設定します。order
- オーダー額 @Nullable protected java.lang.Integer getUserRegistryOrder()
public MessageBrokerRegistry setPathMatcher(PathMatcher pathMatcher)
@MessageMapping
および @SubscribeMapping
メソッドに一致させるために使用する PathMatcher を構成します。 デフォルトでは、AntPathMatcher
が構成されています。ただし、アプリケーションは、"." を使用するようにカスタマイズされた AntPathMatcher
インスタンスを提供する場合があります。(メッセージングで一般的に使用されます)パス区切り文字として "/" の代わりに使用するか、完全に異なる PathMatcher 実装を提供します。
設定された PathMatcher は、設定されたプレフィックスの後の宛先の部分を照合するためにのみ使用されることに注意してください。たとえば、アプリケーションの宛先プレフィックス "/app" と宛先 "/app/price.stock.**" が与えられた場合、メッセージは、型とメソッドレベルのマッピングとしてそれぞれ "price" と "stock.**" を使用してコントローラーにマッピングされる可能性があります。
シンプルブローカーが有効になっている場合、ここで構成された PathMatcher は、メッセージをブローカーするときにメッセージの宛先を照合するためにも使用されます。
@Nullable protected PathMatcher getPathMatcher()
public MessageBrokerRegistry setCacheLimit(int cacheLimit)
これは現在、サブスクリプションレジストリの宛先キャッシュにのみ適用されます。デフォルトのキャッシュ制限は 1024 です。
DefaultSubscriptionRegistry.setCacheLimit(int)
public MessageBrokerRegistry setPreservePublishOrder(boolean preservePublishOrder)
デフォルトでは、"clientOutboundChannel"
に送信されたメッセージは同じ順序で処理されない場合があります。これは、チャネルが ThreadPoolExecutor によってサポートされているため、順番に処理が保証されないためです。
このフラグを true
に設定すると、同じセッション内のメッセージが一度に 1 つずつ "clientOutboundChannel"
に送信され、公開の順序が保持されます。メッセージを正しい順序で保持するためのパフォーマンスのオーバーヘッドがあるため、必要な場合にのみこれを有効にしてください。
@Nullable protected SimpleBrokerMessageHandler getSimpleBroker(SubscribableChannel brokerChannel)
@Nullable protected StompBrokerRelayMessageHandler getStompBrokerRelay(SubscribableChannel brokerChannel)