问题
· 三月 26

%External.Messaging.Client 连接rabbitmqt 报配置错误

大家好:我编写一个简单的连接rabbitmq的测试代码;代码如下:

/// w ##class(Quality.TestMQTT).TestRabbitmq()
ClassMethod TestRabbitmq() As %Status [ Language = objectscript ]
{
Set jgw=$system.external.getJavaGateway()
;write jgw.new("java.util.Date").toString() ,!
set settings = ##class(%External.Messaging.RabbitMQSettings).%New()
set settings.host = "10.32.25.141"
set settings.port = 5672
set settings.virtualHost = "/"
set settings.username = "1892"
set settings.keyPassword = "123456"
set settingString = settings.ToJSON()
#dim client As %External.Messaging.RabbitMQClient
set client = ##class(%External.Messaging.Client).CreateRabbitMQClient(settingString,.status)
if $$$ISERR(status){
"CreateRabbitMQClient:"_$system.Status.GetErrorCodes(status) ,!
"CreateRabbitMQClient:"_$system.Status.GetErrorText(status) ,!
}
if $$$ISOK(status) {
set status = client.BindQueue("his-queue","His-exchange","His-exchange")
if $$$ISOK(status) {
for index=1:1:100 {
1
set message = ##class(%External.Messaging.RabbitMQMessage).%New()
set message.userId="his"
set message.routingKey = "His-exchange"
set message.exchange = "His-exchange"
set message.messageId = "His-exchange"
do message.SetContent("123")
set status = client.SendMessage(message.ToJSON())
}
do client.Close()
else {
"BindQueue:"_$system.Status.GetErrorCodes(status) ,!
"BindQueue:"_$system.Status.GetErrorText(status) ,!
}
} return $$$OK
}

java 网关已经开启:

执行测试代码报错如下:

产品版本: IRIS 2023.1
讨论 (0)1
登录或注册以继续