I think, I found an root cause of null content of event body.
It is because I do use wrong type "WfmAgentScheduleUpdateTopicWfmAgentScheduleUpdateNotification" to handle wfm notification event.
based on documentation and my analyses, it should be "WfmBuScheduleTopicBuScheduleNotification" because this one is matching the event structure explained in documentation.
Is there any documentation, where I can find mapping of [topics] (https://developer.mypurecloud.com/api/rest/v2/notifications/available_topics.html) to Java Classes to be used in notification handler or vice-versa?
But after changing my code to:
public void onEvent(NotificationEvent<?> event) {
log.debug("onEvent Topic=[{}] getEventBodyRaw={} getEventBody={}", getTopic(), event.getEventBodyRaw(), event.getEventBody().toString());
WfmBuScheduleTopicBuScheduleNotification ev = (WfmBuScheduleTopicBuScheduleNotification)event.getEventBody();
}
I'm getting an error:
2020-08-04 09:24:28.372 ERROR 12244 --- [ ReadingThread] c.m.s.v.e.n.NotificationHandler : Cannot construct instance of com.mypurecloud.sdk.v2.model.WfmBuScheduleTopicLocalDate (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('2020-07-27')
at [Source: (String)"{"topicName":"v2.workforcemanagement.businessunits.c91f6138-209b-4321-bc3e-8c1b7afb9029.schedules","version":"2","eventBody":{"status":"Complete","operationId":"cf5213e9-ef42-4920-8ca7-c7a01342b699","eventType":"Update","result":{"id":"297bbf5e-6e7d-4692-b615-a99647f117bb","weekDate":"2020-07-27","weekCount":1,"description":"","published":true,"managementUnits":[{"managementUnit":{"id":"7d181473-f327-4bb1-a84e-03b61e7ab1e4"},"startDate":"2020-07-26T22:00:00.000Z","endDate":"2020-07-31T15:00:00.0"[truncated 275 chars]; line: 1, column: 286] (through reference chain:
It seems to be failing on deserialization of weekDate. Any ideas?
I did update to latest API version 98.0.0 and same issue occurred.
It appears this is an issue with the documented schemas for the notification topics. The v2.users.{id}.workforcemanagement.schedules topic's schema describes the weekDate property as a custom type urn:jsonschema:wfm:bu:schedule:topic:LocalDate, which is an object with its own properties. This is incorrect because the value that's sent in the notification is in fact a string, not a complex object as the schema describes. This causes deserialization to fail. The notification's schema will have to be updated to reflect the correct type.
Please open a case with Genesys Cloud Care to report this problem with the schema; reporting via Care comes with SLAs and various contractual commitments that the forum doesn't. I would suggest copying my above paragraph into the case to help guide the engineer to the cause of the problem.