How to resend a large number of messages in Ensemble
The message viewer can resend messages but it is not suitable for resending a large number of messages (>100). For that, you should use Cache Object Script code such as the following:
{
ClassMethod Resend()
{
//Resend all messages sent from 'FromComponent' to 'ToComponent' between 2016-06-15 and 2016-06-20
&sql(DECLARE C1 CURSOR FOR
SELECT ID INTO :id FROM Ens.MessageHeader
WHERE SourceConfigName='FromComponent' AND TargetConfigName='ToComponent'
AND TimeCreated BETWEEN '2016-06-15' AND '2016-06-20')
&sql(OPEN C1)
&sql(FETCH C1)
set tSC = $$$OK
while (SQLCODE = 0) {
//id holds the id for one message. Resend it
quit:$$$ISERR(tSC)
&sql(FETCH C1)
}
&sql(CLOSE C1)
quit tSC
}
}
You could also add code to this such as better error checking, code to restart where it left off if there's a problem, etc.
Here is documentation for embedded SQL and for Ens.MessageHeader method ResendDuplicatedMessage:
http://docs.intersystems.com/ens20161/csp/docbook/DocBook.UI.Page.cls?KE...
http://docs.intersystems.com/ens20152/csp/documatic/%25CSP.Documatic.cls...