Determining response from Business Process with Response From set

Primary tabs

So we have a custom business service that we use and we are calling SendRequestSync.

Set tSC=..SendRequestSync(tOneTarget,tTargetStream, .tResponse)

For our response from our custom business operation, we send back an Ens.StringResponse.

set pResponse = ##class(Ens.StringResponse).%New()
set pResponse.StringValue = "File Delivery: "_tOutFilename_" of size: "_pRequest.Stream.Size_" (modified='"_pRequest.Stream.LastModified_"')"_" Status: "_tSC
 

So now we are trying to use Rules to pass the the messages to certain destinations with a normal business process of EnsLib.MsgRouter.RoutingEngine with Response From set.

In order to make sure we get multiple responses, we put a + at the front of our Response From list.

So now the problem is that I can see our response make it back to the Business Process.  However, there is no "response" that comes back from the Business Process to the Business Service (shown below).

I see the reference to our response in MessageBodyId.

How do I get that information so I can go back and get my response that was sent into the Business Process?

Thanks,

Tim

Replies

So I found that I have the messagebodyid from the Request (From_UTDHC_Unzip to From_UTDHC_Router) that I could use to go back to message 1288157  and  get the corresponding message id of 1288161 and then use that to check the MessageBodyId field to see if it is a list and spin through all of those.  But is that the most efficient?

Hi Tim,

Assuming you are extending EnsLib.MsgRouter.RoutingEngine, does this work for you?

Mentioned briefly here.

Class User.MyRouter Extends EnsLib.MsgRouter.RoutingEngine
{
Method OnPrepareReply(request As %Persistent, ByRef response As %Persistent)
{
  Set response=##class(Ens.StringContainer).%New()
  Set cnt=$this.%ResponseList.Count()
  For i=1:1:cnt {
    Set messageHeaderId=$this.%ResponseList.GetAt(i)
    Set messageHeader=##class(Ens.MessageHeader).%OpenId(messageHeaderId)
    Set messageBody=$CLASSMETHOD(messageHeader.MessageBodyClassName,"%OpenId",messageHeader.MessageBodyId)
    Set response.StringValue=messageBody.StringValue_"|"_response.StringValue
  }
}
}

viewer