2017-04-19 2 views
0

私はこの形式で話題にプッシュしようとしています/トピック/プッシュ/ {organizationId}私はエラーRabbitMQのトピックフォーマット - サブトピックがメイントピックの下

messagingTemplate.convertAndSend("/topic/pushing/" + obj.getCustomerid(), obj); 

エラー取得しています:

15:06:48.901 [reactor-tcp-io-1] ERROR o.s.m.s.s.StompBrokerRelayMessageHandler - Received ERROR {message=[Invalid destination], content-type=[text/plain], version=[1.0,1.1,1.2], content-length=[53]} session=system text/plain payload='/pushing/2963_ent' is not a valid topic destination

しかし、私は、ドットとスラッシュを置き換えて、この形式/topic/pushing.{organizationId}に変更したときに、それが正常に働いています:

messagingTemplate.convertAndSend("/topic/pushing." + obj.getCustomerid(), obj); 

どのように私はスラッシュを保持することができます/とメイントピックの下にサブトピックがあります。

答えて

1

AMQP 0.9.1 specificationは、このトピックの交換について言いたいことがあります。

The topic exchange type works as follows: 1. A message queue binds to the exchange using a routing pattern, P. 2. A publisher sends the exchange a message with the routing key R. 3. The message is passed to the message queue if R matches P. The routing key used for a topic exchange MUST consist of zero or more words delimited by dots. Each word may contain the letters A-Z and a-z and digits 0-9.

The routing pattern follows the same rules as the routing key with the addition that * matches a single word, and # matches zero or more words. Thus the routing pattern *.stock.# matches the routing keys usd.stock and eur.stock.db but not stock.nasdaq.

だから、「/」ルーティングキーで承認し、使用する区切り文字がドットであるされていません。

関連する問題