Commit cd14efd2 by Adi Amir

adjustmets to new Microservice

parent 83979294
Pipeline #97 skipped in 0 seconds
[ [
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_Utils.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Utils.cpp", "command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_Channel.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Channel.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Utils.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Channel.cpp"
}, },
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_Server.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Server.cpp", "command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_Server.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Server.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Server.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Server.cpp"
}, },
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_RestParser.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_RestParser.cpp", "command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_RestParser.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_RestParser.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_RestParser.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_RestParser.cpp"
}, },
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_Channel.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Channel.cpp", "command": "/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/Rabbitmq.dir/src/RMQ_Utils.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Utils.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Channel.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Utils.cpp"
}, },
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqRecv.dir/test/RabbitMQRecv.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQRecv.cpp", "command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqRecv.dir/test/RabbitMQRecv.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQRecv.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQRecv.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQRecv.cpp"
}, },
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqRecv.dir/test/utils.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp", "command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqRecv.dir/test/utils.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp"
}, },
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqSend.dir/test/RabbitMQSend.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQSend.cpp", "command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqSend.dir/test/RabbitMQSend.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQSend.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQSend.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQSend.cpp"
}, },
{ {
"directory": "/home/amir/git/ipgallery/common/cpp/Rabbitmq", "directory": "/home/adi/git/ipgallery/common/cpp/Rabbitmq",
"command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/amir/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/amir/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqSend.dir/test/utils.cpp.o -c /home/amir/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp", "command": "/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/adi/git/ipgallery/common/cpp/Rabbitmq/src -isystem /home/adi/git/ipgallery/common/cpp/Rabbitmq/../3party/rapidjson-0.11/include/rapidjson -o CMakeFiles/test_RabbitmqSend.dir/test/utils.cpp.o -c /home/adi/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp",
"file": "/home/amir/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp" "file": "/home/adi/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp"
} }
] ]
\ No newline at end of file
File mode changed
...@@ -87,7 +87,7 @@ std::string cRMQ_RestParser::getNodeAsString(rapidjson::Document& rpj_Obj, const ...@@ -87,7 +87,7 @@ std::string cRMQ_RestParser::getNodeAsString(rapidjson::Document& rpj_Obj, const
cNameValuePair* cRMQ_RestParser::parseHeader(std::string s_header) cNameValuePair* cRMQ_RestParser::parseHeader(std::string s_header)
{ {
char *saveptr, *token; char *saveptr;
char* pba_HeaderName = strtok_r((char *)s_header.c_str(), "=", &saveptr); char* pba_HeaderName = strtok_r((char *)s_header.c_str(), "=", &saveptr);
if (pba_HeaderName != NULL) if (pba_HeaderName != NULL)
......
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
ms_Error = ""; ms_Error = "";
} }
cRMQ_Result(eRMQ_Code e_Code, char* pba_error) cRMQ_Result(eRMQ_Code e_Code, const char* pba_error)
{ {
me_Code = e_Code; me_Code = e_Code;
ms_Error = pba_error; ms_Error = pba_error;
......
...@@ -15,10 +15,14 @@ cRMQ_Server::cRMQ_Server() : mc_Channel() ...@@ -15,10 +15,14 @@ cRMQ_Server::cRMQ_Server() : mc_Channel()
{ {
} }
cRMQ_Result cRMQ_Server::Init(const char* pba_Host, int i_Port, const char* pba_exchange, const char* BindingKey, cRMQ_IParser* pc_MsgParser) cRMQ_Result cRMQ_Server::Init(const char* pba_Host, int i_Port, const char* pba_exchange, const char* pba_BindingKey, cRMQ_IParser* pc_MsgParser)
{ {
cRMQ_Result result; cRMQ_Result result;
ms_Host = pba_Host;
mi_Port = i_Port;
ms_Exchange = pba_exchange;
ms_BindingKey = pba_BindingKey;
mpc_MsgParser = pc_MsgParser; mpc_MsgParser = pc_MsgParser;
// open channel // open channel
...@@ -27,7 +31,7 @@ cRMQ_Result cRMQ_Server::Init(const char* pba_Host, int i_Port, const char* pba_ ...@@ -27,7 +31,7 @@ cRMQ_Result cRMQ_Server::Init(const char* pba_Host, int i_Port, const char* pba_
return result; return result;
// open queue // open queue
result = mc_Channel.OpenQueue(pba_exchange, BindingKey); result = mc_Channel.OpenQueue(pba_exchange, pba_BindingKey);
if (result.getCode() != RMQ_SUCCESS) if (result.getCode() != RMQ_SUCCESS)
return result; return result;
...@@ -44,3 +48,8 @@ cRMQ_Result cRMQ_Server::RecieveMessage(cRMQ_Message* pc_Message) ...@@ -44,3 +48,8 @@ cRMQ_Result cRMQ_Server::RecieveMessage(cRMQ_Message* pc_Message)
return mc_Channel.RecieveMessage(pc_Message); return mc_Channel.RecieveMessage(pc_Message);
} }
std::string cRMQ_Server::getQueueString()
{
std::string result = ms_BindingKey + "." + ms_Exchange + "@" + ms_Host + ":" + std::to_string(mi_Port);
return result;
}
...@@ -13,15 +13,24 @@ ...@@ -13,15 +13,24 @@
#include "RMQ_Channel.h" #include "RMQ_Channel.h"
#include "RMQ_IParser.h" #include "RMQ_IParser.h"
#include <string>
class cRMQ_Server class cRMQ_Server
{ {
protected: protected:
cRMQ_Channel mc_Channel; cRMQ_Channel mc_Channel;
cRMQ_IParser* mpc_MsgParser; cRMQ_IParser* mpc_MsgParser;
// server parameters
std::string ms_Host;
int mi_Port;
std::string ms_Exchange;
std::string ms_BindingKey;
public: public:
cRMQ_Server(); cRMQ_Server();
cRMQ_Result Init(const char* pba_Host, int i_Port, const char* pba_exchange, const char* BindingKey, cRMQ_IParser* pc_MsgParser); cRMQ_Result Init(const char* pba_Host, int i_Port, const char* pba_exchange, const char* BindingKey, cRMQ_IParser* pc_MsgParser);
std::string getQueueString();
void Destroy(); void Destroy();
cRMQ_Channel* getChannel() { return &mc_Channel; } cRMQ_Channel* getChannel() { return &mc_Channel; }
......
to start rabbitmq server
========================
rabbitmq-server start
./RabbitMQSend localhost 5672 test1 MyFirstQ BBB ./RabbitMQSend localhost 5672 test1 MyFirstQ BBB
./RabbitMQRecv localhost 5672 test1 MyFirstQ ./RabbitMQRecv localhost 5672 test1 MyFirstQ
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment