小编hes*_*a Z的帖子

从Azure Service Bus队列接收NULL消息正文内容

我正在尝试实现一个Java应用程序,该应用程序与Azure服务总线队列之间收发消息。到门户的连接和消息的发送进展顺利,但是在接收消息并获取消息正文内容时,某些变量缺少其值“空”。我该如何解决这个问题?

这是我用来发送和接收消息的代码:

CompletableFuture<Void> sendMessagesAsync(QueueClient sendClient) {
    List<HashMap<String, String>> data =
            GSON.fromJson(
                    "[" +
                            "{'Device ID' = 'FieldPanel_L1'},"+
                            "{'Sensor1name' = 'FieldPanel_SL1', 'value1' = '0', 'Location of Sensor1 X' = '0.0', 'Location of sensor1 Y' = '0.0'}," +
                            "{'Sensor2name' = 'FieldPanel_SL2', 'value2' = '0', 'Location of Sensor2 X' = '20.0', 'Location of sensor2 Y' = '0.0'},"+
                            "{'Sensor3name' = 'FieldPanel_SL3', 'value3' = '0', 'Location of Sensor3 X' = '40.0', 'Location of sensor3 Y' = '0.0'}"+
                        "]",
                        new TypeToken<List<HashMap<String, String>>>() {}.getType());

    List<CompletableFuture> tasks = …
Run Code Online (Sandbox Code Playgroud)

java azure azureservicebus azure-servicebus-queues

5
推荐指数
1
解决办法
186
查看次数