mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 15:06:50 +08:00
Writing to beanstalk queue
This commit is contained in:
@@ -224,27 +224,15 @@ bool writeToQueue(std::string jsonResult)
|
|||||||
{
|
{
|
||||||
|
|
||||||
Beanstalk::Client client("127.0.0.1", 11300);
|
Beanstalk::Client client("127.0.0.1", 11300);
|
||||||
client.use("test");
|
client.use("alpr");
|
||||||
client.watch("test");
|
//client.watch("test");
|
||||||
|
|
||||||
int id = client.put(jsonResult);
|
int id = client.put(jsonResult);
|
||||||
|
|
||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
return 1;
|
return false;
|
||||||
|
|
||||||
std::cout << "put job id: " << id << std::endl;
|
std::cout << "put job id: " << id << std::endl;
|
||||||
|
|
||||||
Beanstalk::Job job;
|
return true;
|
||||||
client.reserve(job);
|
|
||||||
|
|
||||||
if (job.id() != id)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
std::cout << "reserved job id: "
|
|
||||||
<< job.id()
|
|
||||||
<< " with body: " << job.body() << ""
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
client.del(job.id());
|
|
||||||
std::cout << "deleted job id: " << job.id() << std::endl;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user