Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
gmsec_kafka
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christopher Reis
gmsec_kafka
Commits
6dea7333
Commit
6dea7333
authored
Mar 03, 2017
by
Christopher Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Message Cleaning function
parent
f8045f8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
KafkaConnection.cpp
src/KafkaConnection.cpp
+15
-4
No files found.
src/KafkaConnection.cpp
View file @
6dea7333
...
...
@@ -64,9 +64,20 @@ static void sigterm (int sig) {
run
=
false
;
}
const
char
*
msg
_clean
(
){
const
char
*
msg
Clean
(
std
::
string
msg_str
){
//TODO clean messages to prevent program crashes
return
std
::
string
(
"Test"
).
c_str
();
std
::
string
end
=
"</MESSAGE>"
;
if
(
msg_str
.
compare
(
msg_str
.
length
()
-
end
.
length
(),
end
.
length
(),
end
)
==
0
){
GMSEC_DEBUG
<<
"Message did not have to be Cleaned!"
<<
'\n'
;
return
msg_str
.
c_str
();
}
else
{
GMSEC_DEBUG
<<
"Message had to be Cleaned"
<<
'\n'
;
while
(
msg_str
.
compare
(
msg_str
.
length
()
-
end
.
length
(),
end
.
length
(),
end
)
!=
0
){
msg_str
.
pop_back
();
GMSEC_DEBUG
<<
"Cleaning:
\n
"
<<
msg_str
.
c_str
()
<<
'\n'
;
}
return
msg_str
.
c_str
();
}
}
void
msg_consume
(
RdKafka
::
Message
*
message
,
void
*
opaque
)
{
...
...
@@ -406,10 +417,10 @@ void KafkaConnection::mwReceive(Message*& message, GMSEC_I32 timeout)
std
::
string
msg_str
=
static_cast
<
const
char
*>
(
msg
->
payload
());
if
(
msg_str
.
find
(
"Broker:"
)
!=
string
::
npos
)
{
GMSEC_INFO
<<
msg_str
.
c_str
();
//
GMSEC_INFO << msg_str.c_str();
}
else
{
GMSEC_DEBUG
<<
'\n'
<<
msg_str
.
c_str
();
message
=
new
Message
(
msg
_str
.
c_str
(
));
message
=
new
Message
(
msg
Clean
(
msg_str
));
}
//msg_consume(msg, NULL);
...
...
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