MQTT 라우트된 메시지에 대한 이벤트 스키마

MQTT 메시지는 다음 논리에 따라 Event Grid 토픽에 CloudEvent로 라우트됩니다.

페이로드 형식 표시기=0의 MQTT v3 메시지 또는 MQTT v5 메시지의 경우 페이로드는 data_base64 개체에서 전달되고 다음 스키마 샘플에 따라 base 64 문자열로 인코딩됩니다.

{
	"specversion": "1.0",
	"id": "9aeb0fdf-c01e-0131-0922-9eb54906e20", // unique id stamped by the service.
	"time": "2019-11-18T15:13:39.4589254Z", // timestamp when the message was received by the service.
	"type": "MQTT.EventPublished", // set type for all MQTT messages enveloped by the service.
	"source": "testnamespace", // namespace name
	"subject": "campus/buildings/building17", // topic of the MQTT publish request.
	"data_base64": 
    {
		IlRlbXAiOiAiNzAiLAoiaHVtaWRpdHkiOiAiNDAiCg==
	}
}

콘텐츠 형식= "application/json; charset=utf-8" 또는 페이로드 형식 표시기=1인 MQTT v5 메시지의 경우 페이로드는 데이터 개체에서 전달되고 메시지는 JSON(또는 페이로드가 JSON이 아닌 경우 JSON 문자열)으로 직렬화됩니다. 콘텐츠 형식 및/또는 페이로드 형식 표시기를 설정하면 데이터 필드 내에서 전달되는 페이로드 속성을 있는 그대로 필터링할 수 있습니다. 메시지의 페이로드 필터링에 대해 자세히 알아봅니다.

{
	"specversion": "1.0",
	"id": "9aeb0fdf-c01e-0131-0922-9eb54906e20", // unique id stamped by the service.
	"time": "2019-11-18T15:13:39.4589254Z", // timestamp when the message was received by the service.
	"type": "MQTT.EventPublished", // set type for all MQTT messages enveloped by the service.
	"source": "testnamespace", // namespace name
	"subject": "campus/buildings/building17", // topic of the MQTT publish request. 
	"data": 
    {
		"Temp": 70,
		"humidity": 40
	}
}

이진 콘텐츠 모드를 사용하든 JSON 인코딩(utf-8)에서 구조화된 콘텐츠 모드를 사용하든 CloudEvent용 MQTT 프로토콜 바인딩에 따라 CloudEvent에서 이미 엔벌로프된 MQTT v5 메시지의 경우 이벤트는 다음 스키마 샘플에 따라 보강 후 원래 기본 CloudEvents 특성으로 전달됩니다.

{
	"specverion": "1.0",
	"id": "9aeb0fdf-c01e-0131-0922-9eb54906e20", // original id stamped by the client. 
	"time": "2019-11-18T15:13:39.4589254Z", // timestamp when the message was received by the client
	"type": "Custom.Type", // original type value stamped by the client.
	"source": "Custom.Source", // original source value stamped by the client.
	"subject": " Custom.Subject", // original subjectvalue stamped by the client.
	"data": 
    {
		"Temp": "70",
		"humidity": "40"
	}
}

다음 단계:

다음 문서에서 라우팅에 대해 자세히 알아봅니다.

빠른 시작:

개념: