lab5
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "db.hpp"
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
// Must share the transaction that inserts/updates the job.
|
||||
void enqueue_attachment_job(pqxx::work& tx, const std::string& job_id);
|
||||
|
||||
class OutboxPublisher {
|
||||
public:
|
||||
OutboxPublisher(std::string db_url, std::string broker_url);
|
||||
~OutboxPublisher();
|
||||
OutboxPublisher(const OutboxPublisher&) = delete;
|
||||
OutboxPublisher& operator=(const OutboxPublisher&) = delete;
|
||||
private:
|
||||
void run(const std::string& db_url, const std::string& broker_url);
|
||||
bool wait_interval();
|
||||
std::atomic<bool> stopping_{false};
|
||||
std::mutex mutex_;
|
||||
std::condition_variable cv_;
|
||||
std::thread thread_;
|
||||
};
|
||||
Reference in New Issue
Block a user