Question
· Jun 9, 2020

Determining response from Business Process with Response From set

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

Discussion (3)3
Log in or sign up to continue

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