Skip to Content
Former Member
Jun 19, 2018 at 08:51 AM

Multiple emails generation to the same customer


Hello, I wanted to describe problem I've encountered on 6.6 version of platform.

Problem is occuring when we are trying to send more than one email message to the same customer in the same point of time. After investigating believed reason for this issue is that, when we are setting receiver of a message there is method getEmailService().getOrCreateEmailAddressForEmail() invoked twice - for the first time it creates model object and saves it in database - for the second time it reuses existing model object

typical action done after sending an email is to remove used EmailAddressModel from DB and now, based on in which moment second email process currently is, there are several possibilities:

  • sendEmail is not yet completed, second email won't be send due to "de.hybris.platform.processengine.definition.NodeExecutionException: Error executing ActionNode with ID [sendEmail]: message has no To addresses"

  • sendEmail is completed, removeSentEmail is ongoing:
    • sometimes it happens that item is removed twice without causing an error

    • sometimes it happens that second remove operation throws exception like: "de.hybris.platform.jalo.JaloObjectNoLongerValidException: item PK no longer valid (was removed): object no longer valid"

Do we have in hybris some secure way to send multiple emails at the same time? Or is it some safe solution to queue sending multiple emails ?

I would be very thankful for help in this topic, Best regards.