Announcement

Collapse
No announcement yet.

Prune Error Messages from Mirth

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Prune Error Messages from Mirth

    Hi,

    I am using Mirth 3.2.2.7694

    I would like to get rid of older ERROR messages (Atleast the ones that are more than 180 days old). How can I prune those ERROR messages.
    Currently they just keep lying for ever. And we have no intention of keeping them.. I am hereby talking about production instance where there are more than 1000 such Mirth installs.. And manually deleting data from everyone of them is not possible.

    We have Data pruner turned on, and that deletes successful (SENT status) messages after every 30 days.

  • #2
    On the summary page, below the prune data is a checkbox ('Allow message archiving'). Uncheck that box.

    Comment


    • #3
      I recommend voting for this issue. There is a workaround presented there.

      If you don't want to update the database directly, you can have a channel that makes REST API calls to delete the old ERROR messages the same way you would do it manually from the client.

      http://www.mirthcorp.com/community/i...wse/MIRTH-3116

      Comment


      • #4
        Originally posted by cory_cole View Post
        On the summary page, below the prune data is a checkbox ('Allow message archiving'). Uncheck that box.
        This does not delete the ERROR Messages

        Comment


        • #5
          Originally posted by agermano View Post
          I recommend voting for this issue. There is a workaround presented there.

          If you don't want to update the database directly, you can have a channel that makes REST API calls to delete the old ERROR messages the same way you would do it manually from the client.

          http://www.mirthcorp.com/community/i...wse/MIRTH-3116
          Thanks. Is there any Mirth API available, which can perform the same things..So that we can just call the API to get rid of all the ERROR messages that are too old.
          By the way, I voted for the issue

          Comment


          • #6
            Sorry, I suggested using the REST API, but I don't think that was available until mirth 3.4, and I just noticed you said you were on 3.2.

            You can do it from a dedicated mirth channel using internal classes, but those are not part of a supported API (so subject to change without notice, though it looks like the 3.2 solution will probably still work in 3.8.)

            I don't have time right now to show how to do it in detail, but the method you want to end up calling is removeMessages on the MessageController. See source code here.

            You will need to construct a MessageFilter object to pass to the method along with the channelId. You can probably(?) get by just setting the endDate on the filter and leaving everything else untouched.

            You should be able to find examples in the forums on how to get an instance of the controllers from mirth.

            You can use ChannelUtil.getChannelIds() from the User API to get a list of all channelIds that you can iterate over since this will have to be called per channel.

            For a kind-of-more-supported solution or if you wanted to run it from a different server than the mirth box itself, you could probably use the client-core java library, but that would also require digging into the source code to see how to actually make the client call (that will end up calling the MessageController I mentioned above.)

            The Slack channel is another good place to ask for help if you get stuck on any of the things I mentioned above (though it would be nice to post back here once you have a working solution for the benefit of others.)

            Comment


            • #7
              Thanks. Will try this. Appreciate
              Originally posted by agermano View Post
              Sorry, I suggested using the REST API, but I don't think that was available until mirth 3.4, and I just noticed you said you were on 3.2.

              You can do it from a dedicated mirth channel using internal classes, but those are not part of a supported API (so subject to change without notice, though it looks like the 3.2 solution will probably still work in 3.8.)

              I don't have time right now to show how to do it in detail, but the method you want to end up calling is removeMessages on the MessageController. See source code here.

              You will need to construct a MessageFilter object to pass to the method along with the channelId. You can probably(?) get by just setting the endDate on the filter and leaving everything else untouched.

              You should be able to find examples in the forums on how to get an instance of the controllers from mirth.

              You can use ChannelUtil.getChannelIds() from the User API to get a list of all channelIds that you can iterate over since this will have to be called per channel.

              For a kind-of-more-supported solution or if you wanted to run it from a different server than the mirth box itself, you could probably use the client-core java library, but that would also require digging into the source code to see how to actually make the client call (that will end up calling the MessageController I mentioned above.)

              The Slack channel is another good place to ask for help if you get stuck on any of the things I mentioned above (though it would be nice to post back here once you have a working solution for the benefit of others.)

              Comment

              Working...
              X