added default routing tag
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
d82a8e78dd
commit
3ff0c017db
|
@ -15,9 +15,8 @@ $rabbitLogin=getenv("RABBITMQ_USER");
|
||||||
$rabbitPass=getenv("RABBITMQ_PASSWORD");
|
$rabbitPass=getenv("RABBITMQ_PASSWORD");
|
||||||
$rabbitUseSSL=getenv("RABBITMQ_USE_SSL")==="true";
|
$rabbitUseSSL=getenv("RABBITMQ_USE_SSL")==="true";
|
||||||
$rabbitVirtualHost=getenv("RABBITMQ_VIRTUAL_HOST")?getenv("RABBITMQ_VIRTUAL_HOST"):"/";
|
$rabbitVirtualHost=getenv("RABBITMQ_VIRTUAL_HOST")?getenv("RABBITMQ_VIRTUAL_HOST"):"/";
|
||||||
|
$routingTag=getenv("DEFAULT_TAG")?getenv("DEFAULT_TAG"):null;
|
||||||
|
|
||||||
|
|
||||||
$routingTag=null;
|
|
||||||
$connection=null;
|
$connection=null;
|
||||||
$channel=null;
|
$channel=null;
|
||||||
|
|
||||||
|
@ -54,6 +53,14 @@ function rabbitConnect($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass, $rab
|
||||||
return $connection;
|
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) {
|
function scanner($channel, $port) {
|
||||||
global $routingTag;
|
global $routingTag;
|
||||||
|
|
||||||
|
@ -68,6 +75,7 @@ function scanner($channel, $port) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
$buffer = fgets($fp, 4096);
|
$buffer = fgets($fp, 4096);
|
||||||
$rv=explode("\n", $buffer);
|
$rv=explode("\n", $buffer);
|
||||||
|
|
Loading…
Reference in New Issue