Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery.common.cpp
/
Rabbitmq
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cd14efd2
authored
Jun 02, 2016
by
Adi Amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
adjustmets to new Microservice
parent
83979294
Pipeline
#97
skipped in 0 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
28 deletions
compile_commands.json
doc/install-dependencies.sh
src/RMQ_RestParser.cpp
src/RMQ_Result.h
src/RMQ_Server.cpp
src/RMQ_Server.h
test/commands.txt
compile_commands.json
View file @
cd14efd2
[
[
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/a
mir/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/a
di/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/a
mir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Utils
.cpp"
"file"
:
"/home/a
di/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Channel
.cpp"
},
},
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/a
mir/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/a
di/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/a
mir
/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Server.cpp"
"file"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Server.cpp"
},
},
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/a
mir/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/a
di/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/a
mir
/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_RestParser.cpp"
"file"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_RestParser.cpp"
},
},
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -DRabbitmq_EXPORTS -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -fPIC -I/home/a
mir/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/a
di/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/a
mir/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Channel
.cpp"
"file"
:
"/home/a
di/git/ipgallery/common/cpp/Rabbitmq/src/RMQ_Utils
.cpp"
},
},
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/a
mir/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/a
di/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/a
mir
/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQRecv.cpp"
"file"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQRecv.cpp"
},
},
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/a
mir/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/a
di/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/a
mir
/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp"
"file"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp"
},
},
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/a
mir/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/a
di/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/a
mir
/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQSend.cpp"
"file"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq/test/RabbitMQSend.cpp"
},
},
{
{
"directory"
:
"/home/a
mir
/git/ipgallery/common/cpp/Rabbitmq"
,
"directory"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq"
,
"command"
:
"/usr/bin/g++ -std=c++11 -m64 -g -Wall -O3 -DNDEBUG -I/home/a
mir/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/a
di/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/a
mir
/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp"
"file"
:
"/home/a
di
/git/ipgallery/common/cpp/Rabbitmq/test/utils.cpp"
}
}
]
]
\ No newline at end of file
doc/install-dependencies.sh
100644 → 100755
View file @
cd14efd2
File mode changed
src/RMQ_RestParser.cpp
View file @
cd14efd2
...
@@ -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
)
...
...
src/RMQ_Result.h
View file @
cd14efd2
...
@@ -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
,
c
onst
c
har
*
pba_error
)
{
{
me_Code
=
e_Code
;
me_Code
=
e_Code
;
ms_Error
=
pba_error
;
ms_Error
=
pba_error
;
...
...
src/RMQ_Server.cpp
View file @
cd14efd2
...
@@ -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
;
}
src/RMQ_Server.h
View file @
cd14efd2
...
@@ -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
;
}
...
...
test/commands.txt
View file @
cd14efd2
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment