Currently the following stack trace shows duplicate key message when the EVENT_INSTANCE already exists. We'll still log this message, but catch the SQLIntegrityConstraintViolationException and go ahead and send the JMS message to trigger the activity.
20200106.11:28:12.507 [${StandardInvoke}v0.11:A780] ERROR com.centurylink.mdw.services.process.ProcessExecutorImpl - Failed to send internal event
com.centurylink.mdw.services.ProcessException: Failed to send internal event
at com.centurylink.mdw.services.messenger.InternalMessengerJms.sendDelayedMessage(InternalMessengerJms.java:65)
at com.centurylink.mdw.services.process.ProcessExecutorImpl.sendDelayedInternalEvent(ProcessExecutorImpl.java:1822)
at com.centurylink.mdw.services.process.ProcessExecutorImpl.resumeActivityInstance(ProcessExecutorImpl.java:1809)
at com.centurylink.mdw.services.process.ProcessExecutorImpl.notifyProcess(ProcessExecutorImpl.java:1749)
at com.centurylink.mdw.services.process.ProcessExecutor.notifyProcess(ProcessExecutor.java:1031)
at com.centurylink.mdw.services.event.EventServicesImpl.notifyProcess(EventServicesImpl.java:113)
at com.centurylink.mdw.services.workflow.WorkflowServicesImpl.notify(WorkflowServicesImpl.java:1009)
at com.centurylink.mdw.workflow.activity.event.FallbackProcessor.republishEvents(FallbackProcessor.java:91)
at com.centurylink.mdw.microservice.DependenciesFallbackPublish.process(DependenciesFallbackPublish.java:65)
at com.centurylink.mdw.workflow.activity.event.WaitActivityFallback.lambda$onStartup$0(WaitActivityFallback.java:116)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLIntegrityConstraintViolationException: (conn=161) Duplicate entry 'InternalEvent.10498' for key 'PRIMARY'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:236)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:164)
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:258)
at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:225)
at org.mariadb.jdbc.ClientSidePreparedStatement.execute(ClientSidePreparedStatement.java:145)
at org.mariadb.jdbc.ClientSidePreparedStatement.executeUpdate(ClientSidePreparedStatement.java:176)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
at com.centurylink.mdw.dataaccess.DatabaseAccess.logExecuteUpdate(DatabaseAccess.java:366)
at com.centurylink.mdw.dataaccess.DatabaseAccess.runUpdate(DatabaseAccess.java:497)
at com.centurylink.mdw.service.data.process.EngineDataAccessDB.createEventInstance(EngineDataAccessDB.java:370)
at com.centurylink.mdw.service.data.process.EngineDataAccessDB.createEventInstance(EngineDataAccessDB.java:353)
at com.centurylink.mdw.service.data.process.EngineDataAccessDB.persistInternalEvent(EngineDataAccessDB.java:1273)
at com.centurylink.mdw.services.messenger.InternalMessenger.addMessageNoCaching(InternalMessenger.java:78)
at com.centurylink.mdw.services.messenger.InternalMessengerJms.sendDelayedMessage(InternalMessengerJms.java:60)
... 17 more
Caused by: java.sql.SQLException: Duplicate entry 'InternalEvent.10498' for key 'PRIMARY'
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1599)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1461)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1424)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:240)
at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:216)
... 28 more
Currently the following stack trace shows duplicate key message when the EVENT_INSTANCE already exists. We'll still log this message, but catch the SQLIntegrityConstraintViolationException and go ahead and send the JMS message to trigger the activity.