-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathtestRabbitMQServer.php
More file actions
executable file
·40 lines (35 loc) · 935 Bytes
/
testRabbitMQServer.php
File metadata and controls
executable file
·40 lines (35 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/php
<?php
require_once('path.inc');
require_once('get_host_info.inc');
require_once('rabbitMQLib.inc');
function doLogin($username,$password)
{
// lookup username in databas
// check password
return true;
//return false if not valid
}
function requestProcessor($request)
{
echo "received request".PHP_EOL;
var_dump($request);
if(!isset($request['type']))
{
return "ERROR: unsupported message type";
}
switch ($request['type'])
{
case "login":
return doLogin($request['username'],$request['password']);
case "validate_session":
return doValidate($request['sessionId']);
}
return array("returnCode" => '0', 'message'=>"Server received request and processed");
}
$server = new rabbitMQServer("testRabbitMQ.ini","testServer");
echo "testRabbitMQServer BEGIN".PHP_EOL;
$server->process_requests('requestProcessor');
echo "testRabbitMQServer END".PHP_EOL;
exit();
?>