Support Oslo messaging v2 notifications

Change-Id: Ie5b1013ac2673deb3348a90d068c08e4043018a4
Closes-Bug: #1648479
This commit is contained in:
Simon Pasquier 2016-12-08 14:55:19 +01:00
parent 26c890084d
commit b04c613d7d
1 changed files with 10 additions and 1 deletions

View File

@ -112,7 +112,16 @@ function process_message ()
local data = read_message("Payload")
local ok, notif = pcall(cjson.decode, data)
if not ok then
return -1
return -1, string.format("Failed to parse notification: %s: '%s'", notif, string.sub(data or 'N/A', 1, 64))
end
local oslo_version = notif['oslo.version']
if oslo_version then
-- messagingv2 notifications
ok, notif = pcall(cjson.decode, notif['oslo.message'])
if not ok then
return -1, string.format("Failed to parse v%s notification: %s: '%s'", oslo_version, notif, string.sub(data or 'N/A', 1, 64))
end
end
if include_full_notification then