INSTALLATION
Dependencies:
-
- Note that it MUST be linked with
-Wl,--no-as-needed -ldl
. Not sure why AMQP-CPP devs didn't include it- Easiest way to do this is changing the line in
AMQP-CPP 4.4.10/src/Makefile
- While in
AMQP-CPP 4.3.10
you can run command: sed -i "5 a LD_FLAGS = -Wall -shared -Wl,--no-as-needed -ldl" ./src/Makefile
- Then you can install AMQP-CPP using make
make -j8 && sudo make install && sudo ldconfig
- Easiest way to do this is changing the line in
- If the library is linked incorrectly you will get a linker error in amqpcpp library while compiling your worker
- Note that it MUST be linked with
-
Boost, tested version 1.71
-
ICU, tested version 66.1
Installation using deb file [Recomended]
Creating deb file
mkdir build && \
cd build && \
cmake .. && \
cmake --build . && \
cpack
Deb file installation
dpkg -i ./wsnlp-1.1.0-Linux.deb
Installation: [From orginal nlp-cpp]
mkdir build && \
cd build && \
cmake .. && \
make -j && \
sudo make install
USAGE
To create service you have to include header:
#include "nlpworker.h"
and implement class:
class your_Worker: public NLPWorker
{
public:
void process(string task_path, boost::property_tree::ptree &config, string output_path);
void static_init(boost::property_tree::ptree config);
void init(boost::property_tree::ptree config);
};
add this main function to your file:
int main(int argc, char* argv[])
{
run_workers<your_Worker>(argc,argv);
}
Now you can compile your code with linked -wsnlp library.
To run worker you need to place config .ini file. Below there is a template, fill it properly and if needed add your own section.
[service]
tool = name_of_your_worker
root = /samba/requests/
rabbit_host =
rabbit_user =
rabbit_password =
[tool]
workers_number = number_of_workers