Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $rows = array(
- array('first' => 'aa1', 'second' => 1),
- array('first' => 'aa2', 'second' => 2),
- array('first' => 'aa3', 'second' => 3),
- array('first' => 'aa4', 'second' => 4),
- array('first' => 'aa5', 'second' => 5),
- array('first' => 'aa6', 'second' => 6),
- );
- --- Add to Queue Script
- $msgkey = 1229;
- $msgrs = msg_get_queue($msgkey, 0644);
- foreach ($rows as $row) {
- msg_send($msgrs, 1, $row);
- }
- -
- --- Worker Script
- $msgtype = null;
- $msg = null;
- while ( msg_receive($msgrs, 1, $msgtype, 10240, $msg)) {
- printf('Message pulled from queue - first: %s, second: %s, msgtype: %s' . PHP_EOL,
- $msg['first'], $msg['second'], $msgtype);
- $msgtype = null;
- $msg = null;
- }
- -
Add Comment
Please, Sign In to add comment