Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
1d79e26f
Commit
1d79e26f
authored
Feb 20, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trackrdrd: workers emit MQ client ID to syslog
parent
94187602
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
2 deletions
+54
-2
amq.cpp
trackrdrd/src/activemq/amq.cpp
+17
-0
amq.h
trackrdrd/src/activemq/amq.h
+2
-0
mq.c
trackrdrd/src/mq.c
+6
-0
test_mq.c
trackrdrd/src/test/test_mq.c
+18
-0
trackrdrd.h
trackrdrd/src/trackrdrd.h
+1
-0
worker.c
trackrdrd/src/worker.c
+10
-2
No files found.
trackrdrd/src/activemq/amq.cpp
View file @
1d79e26f
...
@@ -101,6 +101,13 @@ AMQ_Worker::getVersion() {
...
@@ -101,6 +101,13 @@ AMQ_Worker::getVersion() {
return
md
->
getCMSProviderName
()
+
" "
+
md
->
getProviderVersion
();
return
md
->
getCMSProviderName
()
+
" "
+
md
->
getProviderVersion
();
}
}
std
::
string
AMQ_Worker
::
getClientID
()
{
if
(
connection
==
NULL
)
throw
cms
::
IllegalStateException
(
"Connection uninitialized"
);
return
connection
->
getClientID
();
}
const
char
*
const
char
*
AMQ_GlobalInit
(
void
)
AMQ_GlobalInit
(
void
)
{
{
...
@@ -149,6 +156,16 @@ AMQ_Version(AMQ_Worker *worker, char *version)
...
@@ -149,6 +156,16 @@ AMQ_Version(AMQ_Worker *worker, char *version)
CATCHALL
CATCHALL
}
}
const
char
*
AMQ_ClientID
(
AMQ_Worker
*
worker
,
char
*
clientID
)
{
try
{
strcpy
(
clientID
,
worker
->
getClientID
().
c_str
());
return
NULL
;
}
CATCHALL
}
const
char
*
const
char
*
AMQ_WorkerShutdown
(
AMQ_Worker
**
worker
)
AMQ_WorkerShutdown
(
AMQ_Worker
**
worker
)
{
{
...
...
trackrdrd/src/activemq/amq.h
View file @
1d79e26f
...
@@ -62,6 +62,7 @@ public:
...
@@ -62,6 +62,7 @@ public:
virtual
~
AMQ_Worker
();
virtual
~
AMQ_Worker
();
void
send
(
std
::
string
&
text
);
void
send
(
std
::
string
&
text
);
std
::
string
getVersion
();
std
::
string
getVersion
();
std
::
string
getClientID
();
};
};
#else
#else
typedef
struct
AMQ_Worker
AMQ_Worker
;
typedef
struct
AMQ_Worker
AMQ_Worker
;
...
@@ -76,6 +77,7 @@ extern "C" {
...
@@ -76,6 +77,7 @@ extern "C" {
char
*
qName
);
char
*
qName
);
const
char
*
AMQ_Send
(
AMQ_Worker
*
worker
,
const
char
*
data
,
unsigned
len
);
const
char
*
AMQ_Send
(
AMQ_Worker
*
worker
,
const
char
*
data
,
unsigned
len
);
const
char
*
AMQ_Version
(
AMQ_Worker
*
worker
,
char
*
version
);
const
char
*
AMQ_Version
(
AMQ_Worker
*
worker
,
char
*
version
);
const
char
*
AMQ_ClientID
(
AMQ_Worker
*
worker
,
char
*
clientID
);
const
char
*
AMQ_WorkerShutdown
(
AMQ_Worker
**
worker
);
const
char
*
AMQ_WorkerShutdown
(
AMQ_Worker
**
worker
);
const
char
*
AMQ_GlobalShutdown
(
void
);
const
char
*
AMQ_GlobalShutdown
(
void
);
...
...
trackrdrd/src/mq.c
View file @
1d79e26f
...
@@ -96,6 +96,12 @@ MQ_Version(void *priv, char *version)
...
@@ -96,6 +96,12 @@ MQ_Version(void *priv, char *version)
return
AMQ_Version
((
AMQ_Worker
*
)
priv
,
version
);
return
AMQ_Version
((
AMQ_Worker
*
)
priv
,
version
);
}
}
const
char
*
MQ_ClientID
(
void
*
priv
,
char
*
clientID
)
{
return
AMQ_ClientID
((
AMQ_Worker
*
)
priv
,
clientID
);
}
const
char
*
const
char
*
MQ_WorkerShutdown
(
void
**
priv
)
MQ_WorkerShutdown
(
void
**
priv
)
{
{
...
...
trackrdrd/src/test/test_mq.c
View file @
1d79e26f
...
@@ -118,6 +118,23 @@ static const char
...
@@ -118,6 +118,23 @@ static const char
return
NULL
;
return
NULL
;
}
}
static
const
char
*
test_clientID
(
void
)
{
const
char
*
err
;
char
clientID
[
BUFSIZ
];
printf
(
"... testing client ID info
\n
"
);
mu_assert
(
"MQ_ClientID: worker is NULL before call"
,
worker
!=
NULL
);
err
=
MQ_ClientID
(
worker
,
clientID
);
sprintf
(
errmsg
,
"MQ_Version: %s"
,
err
);
mu_assert
(
errmsg
,
err
==
NULL
);
mu_assert
(
"MQ_Version: client ID is empty"
,
clientID
[
0
]
!=
'\0'
);
return
NULL
;
}
static
const
char
static
const
char
*
test_send
(
void
)
*
test_send
(
void
)
{
{
...
@@ -173,6 +190,7 @@ static const char
...
@@ -173,6 +190,7 @@ static const char
mu_run_test
(
test_init_connection
);
mu_run_test
(
test_init_connection
);
mu_run_test
(
test_worker_init
);
mu_run_test
(
test_worker_init
);
mu_run_test
(
test_version
);
mu_run_test
(
test_version
);
mu_run_test
(
test_clientID
);
mu_run_test
(
test_send
);
mu_run_test
(
test_send
);
mu_run_test
(
test_worker_shutdown
);
mu_run_test
(
test_worker_shutdown
);
mu_run_test
(
test_global_shutdown
);
mu_run_test
(
test_global_shutdown
);
...
...
trackrdrd/src/trackrdrd.h
View file @
1d79e26f
...
@@ -152,6 +152,7 @@ const char *MQ_InitConnections(void);
...
@@ -152,6 +152,7 @@ const char *MQ_InitConnections(void);
const
char
*
MQ_WorkerInit
(
void
**
priv
);
const
char
*
MQ_WorkerInit
(
void
**
priv
);
const
char
*
MQ_Send
(
void
*
priv
,
const
char
*
data
,
unsigned
len
);
const
char
*
MQ_Send
(
void
*
priv
,
const
char
*
data
,
unsigned
len
);
const
char
*
MQ_Version
(
void
*
priv
,
char
*
version
);
const
char
*
MQ_Version
(
void
*
priv
,
char
*
version
);
const
char
*
MQ_ClientID
(
void
*
priv
,
char
*
clientID
);
const
char
*
MQ_WorkerShutdown
(
void
**
priv
);
const
char
*
MQ_WorkerShutdown
(
void
**
priv
);
const
char
*
MQ_GlobalShutdown
(
void
);
const
char
*
MQ_GlobalShutdown
(
void
);
...
...
trackrdrd/src/worker.c
View file @
1d79e26f
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "miniobj.h"
#include "miniobj.h"
#define VERSION_LEN 64
#define VERSION_LEN 64
#define CLIENT_ID_LEN 80
static
int
running
=
0
;
static
int
running
=
0
;
...
@@ -137,7 +138,7 @@ static void
...
@@ -137,7 +138,7 @@ static void
void
*
amq_worker
;
void
*
amq_worker
;
dataentry
*
entry
;
dataentry
*
entry
;
const
char
*
err
;
const
char
*
err
;
char
version
[
VERSION_LEN
];
char
version
[
VERSION_LEN
]
,
clientID
[
CLIENT_ID_LEN
]
;
LOG_Log
(
LOG_INFO
,
"Worker %d: starting"
,
wrk
->
id
);
LOG_Log
(
LOG_INFO
,
"Worker %d: starting"
,
wrk
->
id
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_DATA_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_DATA_MAGIC
);
...
@@ -158,6 +159,12 @@ static void
...
@@ -158,6 +159,12 @@ static void
version
[
0
]
=
'\0'
;
version
[
0
]
=
'\0'
;
}
}
err
=
MQ_ClientID
(
amq_worker
,
clientID
);
if
(
err
!=
NULL
)
{
LOG_Log
(
LOG_ERR
,
"Worker %d: Failed to get MQ client ID"
,
wrk
->
id
,
err
);
clientID
[
0
]
=
'\0'
;
}
VSTAILQ_INIT
(
&
wrk
->
wrk_freelist
);
VSTAILQ_INIT
(
&
wrk
->
wrk_freelist
);
wrk
->
wrk_nfree
=
0
;
wrk
->
wrk_nfree
=
0
;
...
@@ -166,7 +173,8 @@ static void
...
@@ -166,7 +173,8 @@ static void
running
++
;
running
++
;
AZ
(
pthread_mutex_unlock
(
&
running_lock
));
AZ
(
pthread_mutex_unlock
(
&
running_lock
));
LOG_Log
(
LOG_INFO
,
"Worker %d: running (%s)"
,
wrk
->
id
,
version
);
LOG_Log
(
LOG_INFO
,
"Worker %d: running (%s, id = %s)"
,
wrk
->
id
,
version
,
clientID
);
while
(
run
)
{
while
(
run
)
{
entry
=
(
dataentry
*
)
SPMCQ_Deq
();
entry
=
(
dataentry
*
)
SPMCQ_Deq
();
...
...
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