develop #3

Merged
palkan merged 2 commits from develop into master 2023-01-26 10:09:28 +00:00
1 changed files with 10 additions and 2 deletions
Showing only changes of commit 3ff0c017db - Show all commits

View File

@ -15,9 +15,8 @@ $rabbitLogin=getenv("RABBITMQ_USER");
$rabbitPass=getenv("RABBITMQ_PASSWORD");
$rabbitUseSSL=getenv("RABBITMQ_USE_SSL")==="true";
$rabbitVirtualHost=getenv("RABBITMQ_VIRTUAL_HOST")?getenv("RABBITMQ_VIRTUAL_HOST"):"/";
$routingTag=getenv("DEFAULT_TAG")?getenv("DEFAULT_TAG"):null;
$routingTag=null;
$connection=null;
$channel=null;
@ -54,6 +53,14 @@ function rabbitConnect($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass, $rab
return $connection;
}
function register($channel, $routingTag) {
print "Register\n";
if (!empty($routingTag)) {
$msg = new AMQPMessage(json_encode(["type"=>"service","data"=>"register"]));
$channel->basic_publish($msg, 'fox.barcode', $routingTag);
}
}
function scanner($channel, $port) {
global $routingTag;
@ -68,6 +75,7 @@ function scanner($channel, $port) {
}
}
while (1) {
$buffer = fgets($fp, 4096);
$rv=explode("\n", $buffer);