@@ -1384,19 +1384,15 @@ const Pulsar = require('../index');
13841384 await initConsumer ( ) ;
13851385
13861386 // 0. Send 6 messages, use different keys and order
1387- await Promise . all ( [
1388- producer . send ( { data : Buffer . from ( '0' ) , partitionKey : 'A' } ) ,
1389- producer . send ( { data : Buffer . from ( '1' ) , partitionKey : 'B' } ) ,
1390- producer . send ( { data : Buffer . from ( '2' ) , partitionKey : 'C' } ) ,
1391- producer . send ( { data : Buffer . from ( '3' ) , partitionKey : 'B' } ) ,
1392- producer . send ( { data : Buffer . from ( '4' ) , partitionKey : 'C' } ) ,
1393- producer . send ( { data : Buffer . from ( '5' ) , partitionKey : 'A' } ) ,
1394- ] ) ;
1395-
1396- // 1. Wait for all message flushed
1387+ producer . send ( { data : Buffer . from ( '0' ) , partitionKey : 'A' } ) ;
1388+ producer . send ( { data : Buffer . from ( '1' ) , partitionKey : 'B' } ) ;
1389+ producer . send ( { data : Buffer . from ( '2' ) , partitionKey : 'C' } ) ;
1390+ producer . send ( { data : Buffer . from ( '3' ) , partitionKey : 'B' } ) ;
1391+ producer . send ( { data : Buffer . from ( '4' ) , partitionKey : 'C' } ) ;
1392+ producer . send ( { data : Buffer . from ( '5' ) , partitionKey : 'A' } ) ;
13971393 await producer . flush ( ) ;
13981394
1399- // 2 . Receive all messages
1395+ // 1 . Receive all messages
14001396 const received = [ ] ;
14011397 for ( let i = 0 ; i < 6 ; i += 1 ) {
14021398 const msg = await receiveAndAck ( ) ;
@@ -1406,7 +1402,7 @@ const Pulsar = require('../index');
14061402 } ) ;
14071403 }
14081404
1409- // Verify message order (based on key dictionary order)
1405+ // 2. Verify message order (based on key dictionary order)
14101406 const expected = [
14111407 { key : 'B' , value : '1' } ,
14121408 { key : 'B' , value : '3' } ,
@@ -1424,15 +1420,13 @@ const Pulsar = require('../index');
14241420 await initConsumer ( ) ;
14251421
14261422 // 1. Send 3 messages to verify orderingKey takes precedence over partitionKey
1427- await Promise . all ( [
1428- producer . send ( {
1429- data : Buffer . from ( '0' ) ,
1430- orderingKey : 'A' ,
1431- partitionKey : 'B' ,
1432- } ) ,
1433- producer . send ( { data : Buffer . from ( '2' ) , orderingKey : 'B' } ) ,
1434- producer . send ( { data : Buffer . from ( '1' ) , orderingKey : 'A' } ) ,
1435- ] ) ;
1423+ producer . send ( {
1424+ data : Buffer . from ( '0' ) ,
1425+ orderingKey : 'A' ,
1426+ partitionKey : 'B' ,
1427+ } ) ;
1428+ producer . send ( { data : Buffer . from ( '2' ) , orderingKey : 'B' } ) ;
1429+ producer . send ( { data : Buffer . from ( '1' ) , orderingKey : 'A' } ) ;
14361430 await producer . flush ( ) ;
14371431
14381432 // 2. Receive messages and verify their order and keys
0 commit comments