Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. $rows = array(
  2. array('first' => 'aa1', 'second' => 1),
  3. array('first' => 'aa2', 'second' => 2),
  4. array('first' => 'aa3', 'second' => 3),
  5. array('first' => 'aa4', 'second' => 4),
  6. array('first' => 'aa5', 'second' => 5),
  7. array('first' => 'aa6', 'second' => 6),
  8. );
  9.  
  10. --- Add to Queue Script
  11. $msgkey = 1229;
  12. $msgrs = msg_get_queue($msgkey, 0644);
  13. foreach ($rows as $row) {
  14. msg_send($msgrs, 1, $row);
  15. }
  16. -
  17.  
  18. --- Worker Script
  19. $msgtype = null;
  20. $msg = null;
  21. while ( msg_receive($msgrs, 1, $msgtype, 10240, $msg)) {
  22. printf('Message pulled from queue - first: %s, second: %s, msgtype: %s' . PHP_EOL,
  23. $msg['first'], $msg['second'], $msgtype);
  24. $msgtype = null;
  25. $msg = null;
  26. }
  27. -
Add Comment
Please, Sign In to add comment