Try to fix filename of incoming app message
We want to have <timestamp>-app-message-<application-id>.json, but before we try to parse the file. Try to fish the application-id out of the message subject or, failing that, of the "application" property. Change-Id: Ibe2f517ff213a0726a10ecebe407f8cb9e5d0de4
This commit is contained in:
parent
98fd21d563
commit
12a9e8aaaf
@ -167,6 +167,8 @@ public class ExnConnector {
|
|||||||
public void onMessage(String key, String address, Map body, Message message, Context context) {
|
public void onMessage(String key, String address, Map body, Message message, Context context) {
|
||||||
try {
|
try {
|
||||||
String app_id = message.subject();
|
String app_id = message.subject();
|
||||||
|
if (app_id == null) app_id = message.property("application").toString(); // should be string already, but don't want to cast
|
||||||
|
// if app_id is still null, the filename will look a bit funky but it's not a problem
|
||||||
log.info("App creation message received", keyValue("appId", app_id));
|
log.info("App creation message received", keyValue("appId", app_id));
|
||||||
JsonNode appMessage = mapper.valueToTree(body);
|
JsonNode appMessage = mapper.valueToTree(body);
|
||||||
Main.logFile("app-message-" + app_id + ".json", appMessage);
|
Main.logFile("app-message-" + app_id + ".json", appMessage);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user