No announcement yet.

Alerts triggered by errors in JS database writer don't have access to {messageId}?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Alerts triggered by errors in JS database writer don't have access to {messageId}?

    Using mirth version 3.8.1. I've set up and alert for a channel's errors. When errors come from the destination transformer (which is Javascript), the alert is able to access the {messageId} variable and pull the correct id. However, when an error originates in the Javascript-based database writer, the alert just returns '{messageId}' instead of the value.

    I tried a bunch of things...
    The global map is accessible from the alert, but putting a message id in there would get overwritten by another processing thread.
    Other destination types - http sender, tcp sender, channel writer, and even a non-javascript-based database writer destination all work.

    I even stripped the database writer code down to just:

    var dbConn;
    dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.mysql.cj.jdbc.Driver','jdbc:mysql://hostort/dbname','','');

    Do I just have to raise specific exceptions within the db writer code and raise alerts when those exceptions are hit, and send the message id in the error string?

  • #2
    I'd still like to have an answer to this since it seeems like a bug or oversight, but a reasonable workaround for me seems to be to raise an exception in the database writer and stick all of the data elements I want, including the message id, into the the error message and parse that our in the channel that the alert sends to.