worked on the file structure
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
|
project(artwork-service-cpp)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
||||||
|
add_executable(artwork-service-cpp
|
||||||
|
main.cpp
|
||||||
|
src/rmq/ConnectionHandler.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(artwork-service-cpp PRIVATE
|
||||||
|
/usr/include
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_directories(artwork-service-cpp PRIVATE
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(artwork-service-cpp PRIVATE
|
||||||
|
amqpcpp
|
||||||
|
pthread
|
||||||
|
dl
|
||||||
|
uv
|
||||||
|
ssl
|
||||||
|
)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
implementeaza metodele de la grpc
|
||||||
|
extrage o imagine dp s3
|
||||||
|
publica in coada {
|
||||||
|
"artwork_id": "72829231",
|
||||||
|
"storage_key": "originals/a8f92.jpg"
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
receive ArtworkCreated
|
||||||
|
|
||||||
|
↓
|
||||||
|
|
||||||
|
download original
|
||||||
|
|
||||||
|
↓
|
||||||
|
|
||||||
|
generate thumbnails
|
||||||
|
|
||||||
|
↓
|
||||||
|
|
||||||
|
store thumbnail.webp in s3
|
||||||
|
|
||||||
|
↓
|
||||||
|
|
||||||
|
wohl kaum: update database
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.idea/
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "libs/rmqcpp"]
|
||||||
|
path = libs/rmqcpp
|
||||||
|
url = https://github.com/bloomberg/rmqcpp.git
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
receive ArtworkCreated
|
||||||
|
|
||||||
|
↓
|
||||||
|
|
||||||
|
download original image
|
||||||
|
|
||||||
|
↓
|
||||||
|
reverse search on WWW
|
||||||
|
|
||||||
|
↓
|
||||||
|
|
||||||
|
update database
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#include "src/rmq/ConnectionHandler.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
#include <amqpcpp.h>
|
||||||
|
#include <uv.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// access to the event loop
|
||||||
|
auto *loop = uv_default_loop();
|
||||||
|
|
||||||
|
// handler for libev
|
||||||
|
ConnectionHandler handler(loop);
|
||||||
|
|
||||||
|
// make a connection
|
||||||
|
|
||||||
|
AMQP::TcpConnection connection(&handler, AMQP::Address("amqps://proxmox:proxmox@mq.pseudot.org:5671/"));
|
||||||
|
|
||||||
|
// we need a channel too
|
||||||
|
AMQP::TcpChannel channel(&connection);
|
||||||
|
|
||||||
|
// create a temporary queue
|
||||||
|
channel.declareQueue("ciao-bella-cpp",AMQP::durable).onSuccess([&connection](const std::string &name, uint32_t messagecount, uint32_t consumercount) {
|
||||||
|
|
||||||
|
// report the name of the temporary queue
|
||||||
|
std::cout << "declared queue " << name << std::endl;
|
||||||
|
});
|
||||||
|
|
||||||
|
// run the loop
|
||||||
|
uv_run(loop, UV_RUN_DEFAULT);
|
||||||
|
|
||||||
|
// done
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#include "ConnectionHandler.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
void ConnectionHandler::onConnected(AMQP::TcpConnection *connection)
|
||||||
|
{
|
||||||
|
std::cout << "TCP CONNECTED\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ConnectionHandler::onReady(AMQP::TcpConnection *connection)
|
||||||
|
{
|
||||||
|
std::cout << "AMQP READY\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionHandler::onError(AMQP::TcpConnection *connection, const char *message)
|
||||||
|
{
|
||||||
|
std::cerr << "AMQP error: " << message << std::endl;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <uv.h>
|
||||||
|
#include <amqpcpp.h>
|
||||||
|
#include <amqpcpp/libuv.h>
|
||||||
|
|
||||||
|
class ConnectionHandler : public AMQP::LibUvHandler {
|
||||||
|
public:
|
||||||
|
ConnectionHandler(uv_loop_t *loop)
|
||||||
|
: AMQP::LibUvHandler(loop)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void onConnected(AMQP::TcpConnection *connection) override;
|
||||||
|
|
||||||
|
void onReady(AMQP::TcpConnection *connection) override;
|
||||||
|
|
||||||
|
void onError(AMQP::TcpConnection *connection, const char *message) override;
|
||||||
|
|
||||||
|
~ConnectionHandler() override = default;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user