如何在发布/订阅响应中检索属性?

时间:2020-07-04 19:55:48

标签: spring spring-boot google-cloud-pubsub

我在Spring Boot中收到来自发布/订阅服务的响应:

public void messageReceiver(Message<String> msg) {
    LOGGER.info(String.valueOf(msg.getHeaders()));
}

是回应:

ReceiverController     : 
{app=232323, id=1111111111, 
gcp_pubsub_original_message=PushedAcknowledgeablePubsubMessage
{projectId='xxx', subscriptionName='xxx', message=data: "MESSAGE TEXT"
attributes {
  key: "app"
  value: "232323"
}
message_id: "33333333333333"
publish_time {
  seconds: 1500000008
  nanos: 200000000
}
}, timestamp=1593892177777}

如何接收属性值以进行进一步处理?

attributes {
  key: "app"
  value: "232323"
}

0 个答案:

没有答案