Skip to content

Commit

Permalink
ReadMsgString utility method
Browse files Browse the repository at this point in the history
  • Loading branch information
eduard93 committed Mar 15, 2018
1 parent 4babfe2 commit a608683
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions RabbitMQ/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,44 @@ ClassMethod ReadMsg(pMsgLen = 32000) As %Status

#Dim stream As %Stream.Object
Set stream = api.readMessageStream(.list)
Write !,"Body: "
Do stream.OutputToDevice()
Write !
set body = stream.Read()
Write !,"Body: ", body,!


Zw list

Set sc= gateway.%Disconnect()
} Catch ex {
Set sc = $$$ADDSC(ex.AsStatus(), $g(%objlasterror))
}

Quit sc
}

/// Read one message.
/// Write $System.Status.GetErrorText(##class(RabbitMQ.Utils).ReadMsgString())
ClassMethod ReadMsgString(pMsgLen = 32000) As %Status
{
#Dim gateway as %Net.Remote.Gateway
#Dim exception as %Exception.AbstractException

Set sc = $$$OK
Try {

Set gateway = ..Connect()
#Dim api As isc.rabbitmq.API
Set api = ..GetAPI(gateway)

#Dim list As %ListOfDataTypes
Set list = api.readMessageString()

Write !,"Body: ",list.GetAt(16),!

Zw list

Set sc= gateway.%Disconnect()
} Catch ex {
break
Set sc = $$$ADDSC(ex.AsStatus(), $g(%objlasterror))
}

Expand Down

0 comments on commit a608683

Please sign in to comment.