MessageBank Helper Class

Hello!,

I was wondering if some one have an example code of the MessageBank Helper Class? , im currently using the MessageBank ok to store all message/events, but i need to be able to search for messages using the bodyclass properties. 

I've read that using MessageBank Helper Class you can do that, but i just cant find anything , documentation only says use the OnBankMSG() method and thats it.

  • 0
  • 0
  • 41
  • 0
  • 1

Answers

Hello.  Here is a suggestion of what you could do. Please note I did not actually try it, so this still needs extra work, but hopefully will help you move forward.

In your helper class, add code to your OnBankMsg() method to index  messages:

ClassMethod OnBankMsg(pHeader As Ens.Enterprise.MsgBank.MessageHeader, pFullHeaderID As %String, pBody As %RegisteredObject = "", pFullBodyID As %String, pService As Ens.Enterprise.MsgBank.TCPService) As %Status
{
 If (pHeader.ClientBodyClassName="mypackage.mymessageclass") {
  Set pStream = ##class(%Stream.GlobalCharacter).%OpenId(pHeader.MessageBodyId)
  Do ##class(mypackage.mysearchtableclass).IndexDoc(pStream)
}
 Quit $$$OK
}

}
 

Where your search table class mypackage.mysearchtableclass would look like:

Class mypackage.mysearchtableclass Extends Ens.CustomSearchTable
{

Property myproperty As ...

ClassMethod OnIndexDoc(pDocObj As %Persistent, pSearchTable As mypackage.mysearchtableclass) As %Status
{

 // Set the properties
 Set pSearchTable.myproperty = ... // extract the information you want to index
 Quit $$$OK
}

}

This is only a sketch, hope it helps,

Heloisa