5 releases
1.0.0-rc1 | Feb 10, 2021 |
---|---|
1.0.0-alpha6 | Feb 9, 2021 |
1.0.0-alpha5 | Feb 5, 2021 |
0.11.11 | Jan 28, 2021 |
0.11.10 | Nov 3, 2020 |
#1097 in Asynchronous
54KB
1.5K
SLoC
C/C++ binding for Rust AMQP Worker
Based on rs_amqp_worker.
Build
To build the rust application
cargo build
To build the provided worker example
gcc -c -Wall -Werror -fpic worker.cpp
gcc -shared -o libworker.so worker.o
Test
To run the unit tests, you must build the provided worker example (see the Build section above).
cargo test
Usage
This worker uses Rust FFI to load a C/C++ Shared Object library, and to execute it. The C/C++ worker must implement some functions to be correctly bound:
char* get_name()
: to retrieve the worker namechar* get_short_description()
: to retrieve a short description of the workerchar* get_description()
: to describe the worker purposechar* get_version()
: to retrieve the worker versionunsigned int get_parameters_size()
: to return the number of parameter, before calling...void get_parameters(Parameter*)
: to fill the allocated pointer with the worker parametersint process(void*, char* (*)(void*, const char*), void* ()(void*, unsigned char), void* (*)(const char*, const char*), const char**, const char***)
: to execute the worker process
For more details, see the provided worker.cpp example.
Set the WORKER_LIBRARY_FILE
environment variable to specify the path of your C/C++ worker shared-library. Otherwise, the libworker.so
file will be loaded by default.
Dependencies
~23–42MB
~682K SLoC