我正在尝试使用Rabbitmq上的新创建用户从springbok应用程序连接到rabitmq,但根据日志,该应用程序始终尝试与默认的来宾用户连接
rabbitmq日志
#r @"packages\Moq\lib\net45\Moq.dll"
#r @"packages\NUnit\lib\net45\nunit.framework.dll"
#r @"packages\FsUnit\lib\net46\FsUnit.NUnit.dll"
#r @"packages\System.Threading.Tasks.Extensions\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll"
open Moq
open FsUnit
open System.Threading.Tasks
type MemberMarketUpdate =
{ Id: string }
type IAssociationRepository =
abstract Update : MemberMarketUpdate -> Task<bool>
let verifyUpdate(update:MemberMarketUpdate) =
update.Id |> should equal "market id"
let associationRepository = new Mock<IAssociationRepository>();
let setup = associationRepository.Setup (fun r -> r.Update(It.IsAny<MemberMarketUpdate>() ))
setup.Callback(fun update -> verifyUpdate update) |> ignore
setup.Returns(Task.FromResult(true))
setup.ReturnsAsync(true)
yaml spring boot应用程序配置
2019-02-13 00:12:38.860 [error] <0.1318.0> Error on AMQP connection <0.1318.0> (192.168.1.185:60124 -> 192.168.1.185:5672, state: starting):
PLAIN login refused: user 'guest' can only connect via localhost
spring boot错误日志
spring:
rabbitmq:
host: 111.111.111.111
port: 5672
username: user1
password: user1
connectionName: com.test.user
答案 0 :(得分:0)
在springboot应用程序的“资源”下,您可以创建一个 application.properties 文件并配置以下信息。
spring.rabbitmq.host=111.111.111.111
spring.rabbitmq.port=5672
spring.rabbitmq.username=user1
spring.rabbitmq.password=user1
答案 1 :(得分:0)
您可以这样写:
rabbitmq:
config:
host: 111.111.111.111
port: 5672
username: user1
password: user1
connectionName: com.test.user