@@ -1374,11 +1374,33 @@ function on_basic_get_empty_or_ok(chan::MessageChannel, m::TAMQPMethodFrame, ctx
1374
1374
nothing
1375
1375
end
1376
1376
1377
+ function on_channel_message_completed (chan:: MessageChannel , msg:: Message )
1378
+ # got all data for msg
1379
+ if isempty (msg. consumer_tag)
1380
+ put! (chan. chan_get, pop! (chan. partial_msgs))
1381
+ else
1382
+ lock (chan. lck) do
1383
+ if msg. consumer_tag in keys (chan. consumers)
1384
+ put! (chan. consumers[msg. consumer_tag]. recvq, pop! (chan. partial_msgs))
1385
+ else
1386
+ put! (get! (()-> Channel {Message} (typemax (Int)), chan. pending_msgs, msg. consumer_tag), msg)
1387
+ @debug (" holding message, no consumer yet with tag" , tag= msg. consumer_tag)
1388
+ end
1389
+ end
1390
+ end
1391
+ nothing
1392
+ end
1393
+
1377
1394
function on_channel_message_in (chan:: MessageChannel , m:: TAMQPContentHeaderFrame , ctx)
1378
1395
msg = last (chan. partial_msgs)
1379
1396
msg. properties = m. hdrpayload. proplist
1380
1397
msg. data = Vector {UInt8} (undef, m. hdrpayload. bodysize)
1381
1398
msg. filled = 0
1399
+
1400
+ if m. hdrpayload. bodysize == 0
1401
+ # got all data for msg
1402
+ on_channel_message_completed (chan, msg)
1403
+ end
1382
1404
nothing
1383
1405
end
1384
1406
@@ -1392,18 +1414,7 @@ function on_channel_message_in(chan::MessageChannel, m::TAMQPContentBodyFrame, c
1392
1414
1393
1415
if msg. filled >= length (msg. data)
1394
1416
# got all data for msg
1395
- if isempty (msg. consumer_tag)
1396
- put! (chan. chan_get, pop! (chan. partial_msgs))
1397
- else
1398
- lock (chan. lck) do
1399
- if msg. consumer_tag in keys (chan. consumers)
1400
- put! (chan. consumers[msg. consumer_tag]. recvq, pop! (chan. partial_msgs))
1401
- else
1402
- put! (get! (()-> Channel {Message} (typemax (Int)), chan. pending_msgs, msg. consumer_tag), msg)
1403
- @debug (" holding message, no consumer yet with tag" , tag= msg. consumer_tag)
1404
- end
1405
- end
1406
- end
1417
+ on_channel_message_completed (chan, msg)
1407
1418
end
1408
1419
1409
1420
nothing
0 commit comments