Fixes to RabbitMQ filter and consumer.

This commit is contained in:
Markus Makela 2015-01-30 18:03:20 +02:00
parent 5d6b805d6e
commit ab6418c939
6 changed files with 15 additions and 16 deletions

View File

@ -100,10 +100,6 @@ add_subdirectory(server)
if(NOT WITHOUT_MAXADMIN)
add_subdirectory(client)
endif()
if(BUILD_RABBITMQ)
find_package(RabbitMQ)
add_subdirectory(rabbitmq_consumer)
endif()
file(GLOB DOCS Documentation/*.pdf)
message(STATUS "Installing MaxScale to: ${CMAKE_INSTALL_PREFIX}/")

View File

@ -3,10 +3,11 @@ include(../macros.cmake)
enable_testing()
set_variables()
set(CMAKE_INSTALL_PREFIX "/usr/local/skysql/rabbitmq-consumer" CACHE PATH "Prefix prepended to install directories.")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake")
project("RabbitMQ Consumer")
configure_file(${CMAKE_SOURCE_DIR}/consumer.c ${CMAKE_BINARY_DIR}/consumer.c)
find_package(RabbitMQ)
find_package(MySQLClient)
@ -14,9 +15,10 @@ find_package(MySQLClient)
set(CMAKE_C_FLAGS "-Wall -fPIC")
set(CMAKE_CXX_FLAGS "-Wall -fPIC")
include_directories(${MYSQLCLIENT_HEADERS})
include_directories(${RABBITMQ_HEADERS})
include_directories(inih)
add_subdirectory(inih)
add_executable (consumer consumer.c)
add_executable (consumer ${CMAKE_BINARY_DIR}/consumer.c)
if(MYSQLCLIENT_FOUND)
target_link_libraries(consumer ${MYSQLCLIENT_LIBRARIES} rabbitmq inih ssl crypt crypto dl z m pthread)

View File

@ -1,8 +0,0 @@
#Use the '-I' prefix for include and '-L' for library directories
#You can use multiple library and include directories
#Path to the rabbitmq-c and mysqlclient libraries
LIBRARY_DIRS :=-L/usr/lib64
#path to headers
INCLUDE_DIRS :=-I/usr/include -I/usr/include/mysql

View File

@ -337,6 +337,7 @@ int main(int argc, char** argv)
MYSQL db_inst;
char ch, *cnfname = NULL, *cnfpath = NULL;
static const char* fname = "consumer.cnf";
const char* default_path = "@CMAKE_INSTALL_PREFIX@/etc";
if((c_inst = calloc(1,sizeof(CONSUMER))) == NULL){
fprintf(stderr, "Fatal Error: Cannot allocate enough memory.\n");
@ -359,6 +360,12 @@ int main(int argc, char** argv)
}
}
if(cnfpath == NULL)
{
cnfpath = strdup(default_path);
cnfnlen = strlen(default_path);
}
cnfname = calloc(cnfnlen + strlen(fname) + 1,sizeof(char));
if(cnfpath){

View File

@ -1,6 +1,8 @@
if(BUILD_RABBITMQ)
find_package(RabbitMQ)
include_directories(${RABBITMQ_HEADERS})
add_library(mqfilter SHARED mqfilter.c)
target_link_libraries(mqfilter query_classifier log_manager utils rabbitmq)
target_link_libraries(mqfilter query_classifier log_manager utils ${RABBITMQ_LIBRARIES})
install(TARGETS mqfilter DESTINATION modules)
endif()

View File

@ -36,7 +36,7 @@
*
* logging_trigger Set the logging level
* logging_strict Sets whether to trigger when any of the parameters match or only if all parameters match
* logging_log_all Log only SELECT, UPDATE, DELETE and INSERT or all posddible queries
* logging_log_all Log only SELECT, UPDATE, DELETE and INSERT or all possible queries
* hostname The server hostname where the messages are sent
* port Port to send the messages to
* username Server login username