File tree Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,44 @@ ClassMethod ReadMsg(pMsgLen = 32000) As %Status
58
58
59
59
#Dim stream As %Stream.Object
60
60
Set stream = api .readMessageStream (.list )
61
- Write !," Body: "
62
- Do stream .OutputToDevice ()
63
- Write !
61
+ set body = stream .Read ()
62
+ Write !," Body: " , body ,!
63
+
64
+
65
+ Zw list
66
+
67
+ Set sc = gateway .%Disconnect ()
68
+ } Catch ex {
69
+ Set sc = $$$ADDSC(ex .AsStatus (), $g (%objlasterror ))
70
+ }
71
+
72
+ Quit sc
73
+ }
74
+
75
+ /// Read one message.
76
+ /// Write $System.Status.GetErrorText(##class(RabbitMQ.Utils).ReadMsgString())
77
+ ClassMethod ReadMsgString (pMsgLen = 32000 ) As %Status
78
+ {
79
+ #Dim gateway as %Net.Remote.Gateway
80
+ #Dim exception as %Exception.AbstractException
81
+
82
+ Set sc = $$$OK
83
+ Try {
84
+
85
+ Set gateway = ..Connect ()
86
+ #Dim api As isc.rabbitmq.API
87
+ Set api = ..GetAPI (gateway )
88
+
89
+ #Dim list As %ListOfDataTypes
90
+ Set list = api .readMessageString ()
91
+
92
+ Write !," Body: " ,list .GetAt (16 ),!
64
93
65
94
Zw list
66
95
67
96
Set sc = gateway .%Disconnect ()
68
97
} Catch ex {
98
+ break
69
99
Set sc = $$$ADDSC(ex .AsStatus (), $g (%objlasterror ))
70
100
}
71
101
You can’t perform that action at this time.
0 commit comments