Rabbit MQ使用嵌入List拒绝JSON

时间:2015-11-20 06:04:17

标签: java json rabbitmq amqp

我们有一个AMQP消息传递客户端将以下消息转发给RabbitMQ服务器:

DEBUG - ObservationGroupTopic      -  [x] Sent {
  "uniqueIdentifier" : "11111111",
  "ward" : "WARD",
  "observationDate" : 1447626600000,
  "requestDate" : 1447333200000,
  "specimenReceivedDate" : 1447637400000,
  "statusDate" : 1447647660000,
  "status" : "F",
  "groupServiceCode" : "XM",
  "groupServiceDescription" : "CROSS MATCH",
  "observationUnitList" : [ ]
}

这可以正常工作。但是,如果我们使用List元素扩展JSON:

{
  "uniqueIdentifier" : "1111111",
  "ward" : "WARD",
  "observationDate" : 1447635600000,
  "requestDate" : 1447160400000,
  "specimenReceivedDate" : 1447638060000,
  "statusDate" : 1447647660000,
  "status" : "P",
  "groupServiceCode" : "MC",
  "groupServiceDescription" : "MICRO/CULTURE",
  "observationUnitList" : [ {
    "valueType" : "NM",
    "value" : "0.0",
    "units" : null,
    "referenceRange" : null,
    "observationTypeCode" : "5803-2",
    "observationTypeDescription" : "pH",
    "abnormalFlag" : "U",
    "status" : "P",
    "observationDateTime" : 1447647660000
  } ]
}

邮件无法发送并显示错误

com.rabbitmq.client.AlreadyClosedException: connection is already closed due to clean connection shutdown; protocol method: #method<connection.close>(reply-code=200, reply-text=OK, class-id=0, method-id=0)

这是可重复的,每个类似结构的消息都会失败。我猜是有一个消息问题,RabbitMQ告诉连接“go-away”?

我们的邮件结构有问题吗? “nulls”有问题吗?

1 个答案:

答案 0 :(得分:0)

原来这是我的错误 - 我正在关闭一个catch子句而不是内部的连接 - 为麻烦道歉......