In the past it used to be impossible to send messages through the messaging API in the middle of a database transaction. Is that sill the case?
It looks like that got solved in Moodle 2.8: MDL-45941
Currently (since it had to work before Moodle 2.8 was released) the quiz handles this be subscribing to its own events like \mod_quiz\event\attempt_submitted with a funciton like quiz_attempt_submitted_handler, and sends the messages in the event handler.
I need to change things so that the quiz is more intelligent about which messages is sends (MDL-47691). As part of this I need more data in the event handler. In particular I need the $attemptobj instance of the quiz_attempt class (which contains a question_usage_by_activity object). Am allowed to pass a big complex object through $event->add_record_snapshot()? I believe the answer is no, but woudl appreciate confirmation.
Does anyone have a view about the best way to handle this. Perhaps now that MDL-45941 is fixed, the best thing would be to take event handlers out of the equation here, and just send the messages?
Thanks for any help you can offer.