Avoiding some destination script stop your channel by running the task in another thread #4954
Replies: 4 comments 6 replies
-
As you mentioned "use at your own risk". One risk is that a user should know if their data is expected to process in order both for a single destination and potentially all destinations. Just a note, not a criticism. |
Beta Was this translation helpful? Give feedback.
-
@davutg - What database engine do you usually use? |
Beta Was this translation helpful? Give feedback.
-
I have a comment about the syntax. The suggestion may not be future proof as it does not use standard javascript syntax, and the rhino project is looking to eliminate some of the non-standard legacy syntax in future versions. Also, some older mirth versions won't support the shortened ES6 way of defining a function property on the object. This would be the most compatible way to write it for old and future mirth version. Note this appears to use an interface as a constructor that takes an object as the implementation rather than mimicking the java anonymous class syntax. Under the hood, both syntax options do the same thing. var task = new java.lang.Runnable({
run: function run() {
try {
dbConn =...
//your code goes here
} finally {
if (dbConn) {
dbConn.close();
}
}
}
}); |
Beta Was this translation helpful? Give feedback.
-
We've some DB Writer channels, a few times a year the channel was stucking on a message and further messages were not being processed due to that reason until we reset the channel.
I think it was happening due to some DB related issues, maybe a record was locked
for update
or kinda reason. I've developed below method in order to process destination task in a different thread to avoid this issue. More than a year we've never faced any issue for the channels we applied this.You can use it at your own risk, not only for DB writing JS channel tasks but for some others as well.
Running the task with task executor
Beta Was this translation helpful? Give feedback.
All reactions