Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

media-cloud-ai/c_amqp_worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C/C++ binding for Rust AMQP Worker

Based on rs_amqp_worker.

Build Status Coverage Status

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 name
  • char* get_short_description(): to retrieve a short description of the worker
  • char* get_description(): to describe the worker purpose
  • char* get_version(): to retrieve the worker version
  • unsigned int get_parameters_size(): to return the number of parameter, before calling...
  • void get_parameters(Parameter*) : to fill the allocated pointer with the worker parameters
  • int process(void*, char* (*)(void*, const char*), int* (*)(), void* (*)(const char*)): to execute the worker process

For more details, see the provided worker.cpp example.