Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
dcdb
dcdb
Commits
502468eb
Commit
502468eb
authored
Jun 19, 2020
by
Michael Ott
Browse files
Provide parameter -q to specify MQTT QoS
parent
c338b12f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/dcdbslurmjob/dcdbslurmjob.cpp
View file @
502468eb
...
...
@@ -63,6 +63,7 @@ void usage() {
std
::
cout
<<
"Options:"
<<
std
::
endl
;
std
::
cout
<<
" -b<hosts> List of MQTT brokers [default: localhost:1883]"
<<
std
::
endl
;
std
::
cout
<<
" -q<qos> MQTT QoS to use [default: 0]"
<<
std
::
endl
;
std
::
cout
<<
" -c<hosts> List of Cassandra hosts [default: none]"
<<
std
::
endl
;
std
::
cout
<<
" -u<username> Cassandra username [default: none]"
<<
std
::
endl
;
std
::
cout
<<
" -p<password> Cassandra password [default: none]"
<<
std
::
endl
;
...
...
@@ -171,10 +172,11 @@ int main(int argc, char** argv) {
int
port
;
std
::
string
nodelist
=
""
,
jobId
=
""
,
userId
=
""
;
std
::
string
substitution
=
""
;
int
qos
=
0
;
uint64_t
ts
=
0
;
// Defining options
const
char
*
opts
=
"b:c:u:p:n:t:j:i:s:h"
;
const
char
*
opts
=
"b:
q:
c:u:p:n:t:j:i:s:h"
;
char
ret
;
while
((
ret
=
getopt
(
argc
,
argv
,
opts
))
!=-
1
)
{
...
...
@@ -204,6 +206,9 @@ int main(int argc, char** argv) {
splitHostList
(
optarg
,
hostList
);
break
;
}
case
'q'
:
qos
=
atoi
(
optarg
);
break
;
case
'c'
:
cassandra
=
true
;
splitHostList
(
optarg
,
hostList
);
...
...
@@ -291,7 +296,7 @@ int main(int argc, char** argv) {
std
::
cerr
<<
"Could not connect to MQTT broker "
<<
host
<<
":"
<<
port
<<
std
::
endl
;
return
1
;
}
std
::
cout
<<
"Connected to MQTT broker "
<<
host
<<
":"
<<
port
<<
std
::
endl
;
std
::
cout
<<
"Connected to MQTT broker "
<<
host
<<
":"
<<
port
<<
", using QoS "
<<
qos
<<
std
::
endl
;
}
//collect job data
...
...
@@ -408,7 +413,7 @@ int main(int argc, char** argv) {
mosquitto_publish_callback_set
(
_mosq
,
publishCallback
);
uint64_t
startTs
=
getTimestamp
();
//send it to broker
if
(
mosquitto_publish
(
_mosq
,
&
msgId
,
topic
.
c_str
(),
payload
.
length
(),
payload
.
c_str
(),
1
,
false
)
!=
MOSQ_ERR_SUCCESS
)
{
if
(
mosquitto_publish
(
_mosq
,
&
msgId
,
topic
.
c_str
(),
payload
.
length
(),
payload
.
c_str
(),
qos
,
false
)
!=
MOSQ_ERR_SUCCESS
)
{
std
::
cerr
<<
"Broker not reachable! Job data was not published."
<<
std
::
endl
;
retCode
=
1
;
goto
exit
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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