私はokを実行しているアプリケーションをactivemqに送信しています。私はspring.netとNmstemplateを使ってブローカーに接続しています。一般的に XML設定ファイルは次のとおりです。ユーザ名/パスワードでactiveMQへの接続を認証します。
<object id="ActiveMqConnectionFactory"
type="Apache.NMS.ActiveMQ.ConnectionFactory, Apache.NMS.ActiveMQ">
</object>
<object id="ConnectionFactory"
type="Spring.Messaging.Nms.Connections.CachingConnectionFactory, Spring.Messaging.Nms">
<constructor-arg index="0" ref="ActiveMqConnectionFactory"/>
<property name="SessionCacheSize" value="10"/>
</object>
<object id="NmsTemplate"
type="Spring.Messaging.Nms.Core.NmsTemplate, Spring.Messaging.Nms">
<constructor-arg index="0" ref="ConnectionFactory"/>
<property name="MessageConverter" ref="SimpleMessageConverter"/>
</object>
<object id="SimpleMessageConverter"
type="Spring.Messaging.Nms.Support.Converter.SimpleMessageConverter, Spring.Messaging.Nms">
</object>
すべてが)NmsTemplate.ConvertAndSend(とメッセージを送っ見つける作業をするまでは、 問題は、ユーザー名/パスワードを使用して接続を保護したいということです。 私は設定ファイルをactivemqで設定しましたが、今ではこのコードをコードで提供する必要があります。 私が試した:
<object id="ActiveMqConnectionFactory" type="Apache.NMS.ActiveMQ.ConnectionFactory, Apache.NMS.ActiveMQ">
<property name="UserName" value="usertest"/>
<property name="Password" value="passwordtest"/>
</object>
しかし、私は取得送信する際に、例外、およびコードで同じ設定の資格情報を「接続が既に閉じられて」。
誰かが、安全なactivemqブローカーにメッセージを送信するためのユーザー名/パスワードの設定方法の良い例やヒントを持っていますか?
にこの答えを見つけましたか? –