Debian Codegraph @

README.md

raw symbols SCIP
1 # RabbitMQ C AMQP client library
2
3 ![Build Status](https://github.com/alanxz/rabbitmq-c/actions/workflows/ci.yml/badge.svg)
4
5 [![Coverage Status](https://coveralls.io/repos/github/alanxz/rabbitmq-c/badge.svg?branch=master)](https://coveralls.io/github/alanxz/rabbitmq-c?branch=master)
6
7 [![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/rabbitmq-c.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#rabbitmq-c)
8
9 [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/7001/badge)](https://www.bestpractices.dev/projects/7001)
10
11 ## Introduction
12
13 This is a C-language AMQP client library for use with v2.0+ of the
14 [RabbitMQ](http://www.rabbitmq.com/) broker.
15
16 - <http://github.com/alanxz/rabbitmq-c>
17
18 Announcements regarding the library are periodically made on the
19 rabbitmq-c-users and cross-posted to rabbitmq-users.
20
21 - <https://groups.google.com/forum/#!forum/rabbitmq-c-users>
22 - <https://groups.google.com/forum/#!forum/rabbitmq-users>
23
24 ## Latest Stable Version
25
26 The latest stable release of rabbitmq-c can be found at:
27
28 - <https://github.com/alanxz/rabbitmq-c/releases/latest>
29
30 ## Documentation
31
32 API documentation for v0.8.0+ can viewed from:
33
34 <http://alanxz.github.io/rabbitmq-c/docs/0.8.0/>
35
36 ## Getting started
37
38 ### Building and installing
39
40 #### Prereqs:
41 - [CMake v3.22 or better](http://www.cmake.org/)
42 - A C compiler (GCC 4.4+, clang, and MSVC are test. Other compilers may also
43 work)
44 - *Optionally* [OpenSSL](http://www.openssl.org/) v1.1.1+ to enable support for
45 connecting to RabbitMQ over SSL/TLS
46 - *Optionally* [POpt](http://freecode.com/projects/popt) to build some handy
47 command-line tools.
48 - *Optionally* [XmlTo](https://fedorahosted.org/xmlto/) to build man pages for
49 the handy command-line tools
50 - *Optionally* [Doxygen](http://www.stack.nl/~dimitri/doxygen/) to build
51 developer API documentation.
52
53 After downloading and extracting the source from a tarball to a directory
54 ([see above](#latest-stable-version)), the commands to build rabbitmq-c on most
55 systems are:
56
57 mkdir build && cd build
58 cmake ..
59 cmake --build . [--config Release]
60
61 The --config Release flag should be used in multi-configuration generators e.g.,
62 Visual Studio or XCode.
63
64 It is also possible to point the CMake GUI tool at the CMakeLists.txt in the root of
65 the source tree and generate build projects or IDE workspace
66
67 Installing the library and optionally specifying a prefix can be done with:
68
69 cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
70 cmake --build . [--config Release] --target install
71
72 More information on CMake can be found on its FAQ (http://www.cmake.org/Wiki/CMake_FAQ)
73
74 Other interesting flags that can be passed to CMake:
75
76 * `BUILD_EXAMPLES=ON/OFF` toggles building the examples. OFF by default.
77 * `BUILD_SHARED_LIBS=ON/OFF` toggles building rabbitmq-c as a shared library.
78 ON by default.
79 * `BUILD_STATIC_LIBS=ON/OFF` toggles building rabbitmq-c as a static library.
80 ON by default.
81 * `BUILD_TESTING=ON/OFF` toggles building test code. ON by default.
82 * `BUILD_TOOLS=ON/OFF` toggles building the command line tools. By default
83 this is ON if the build system can find the POpt header and library.
84 * `BUILD_TOOLS_DOCS=ON/OFF` toggles building the man pages for the command line
85 tools. By default this is ON if BUILD_TOOLS is ON and the build system can
86 find the XmlTo utility.
87 * `ENABLE_SSL_SUPPORT=ON/OFF` toggles building rabbitmq-c with SSL support. By
88 default this is ON if the OpenSSL headers and library can be found.
89 * `BUILD_API_DOCS=ON/OFF` - toggles building the Doxygen API documentation, by
90 default this is OFF
91 * `RUN_SYSTEM_TESTS=ON/OFF` toggles building the system tests (i.e. tests requiring
92 an accessible RabbitMQ server instance on localhost), by default this is OFF
93
94 ## Building RabbitMQ - Using vcpkg
95
96 You can download and install RabbitMQ using the [vcpkg](https://github.com/Microsoft/vcpkg)
97 dependency manager:
98
99 git clone https://github.com/Microsoft/vcpkg.git
100 cd vcpkg
101 ./bootstrap-vcpkg.sh
102 ./vcpkg integrate install
103 ./vcpkg install librabbitmq
104
105 The RabbitMQ port in vcpkg is kept up to date by Microsoft team members and
106 community contributors. If the version is out of date,
107 please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
108
109 ## Running the examples
110
111 Arrange for a RabbitMQ or other AMQP server to be running on
112 `localhost` at TCP port number 5672.
113
114 In one terminal, run
115
116 ./examples/amqp_listen localhost 5672 amq.direct test
117
118 In another terminal,
119
120 ./examples/amqp_sendstring localhost 5672 amq.direct test "hello world"
121
122 You should see output similar to the following in the listener's
123 terminal window:
124
125 Delivery 1, exchange amq.direct routingkey test
126 Content-type: text/plain
127 ----
128 00000000: 68 65 6C 6C 6F 20 77 6F : 72 6C 64 hello world
129 0000000B:
130
131 ## Writing applications using `librabbitmq`
132
133 Please see the `examples` directory for short examples of the use of
134 the `librabbitmq` library.
135
136 ### Threading
137
138 You cannot share a socket, an `amqp_connection_state_t`, or a channel
139 between threads using `librabbitmq`. The `librabbitmq` library is
140 built with event-driven, single-threaded applications in mind, and
141 does not yet cater to any of the requirements of `pthread`ed
142 applications.
143
144 Your applications instead should open an AMQP connection (and an
145 associated socket, of course) per thread. If your program needs to
146 access an AMQP connection or any of its channels from more than one
147 thread, it is entirely responsible for designing and implementing an
148 appropriate locking scheme. It will generally be much simpler to have
149 a connection exclusive to each thread that needs AMQP service.
150
151 ### License & Copyright
152
153 Portions created by Alan Antonuk are Copyright (c) 2012-2021
154 Alan Antonuk. All Rights Reserved.
155
156 Portions created by VMware are Copyright (c) 2007-2012 VMware, Inc.
157 All Rights Reserved.
158
159 Portions created by Tony Garnock-Jones are Copyright (c) 2009-2010
160 VMware, Inc. and Tony Garnock-Jones. All Rights Reserved.
161
162 Permission is hereby granted, free of charge, to any person
163 obtaining a copy of this software and associated documentation
164 files (the "Software"), to deal in the Software without
165 restriction, including without limitation the rights to use, copy,
166 modify, merge, publish, distribute, sublicense, and/or sell copies
167 of the Software, and to permit persons to whom the Software is
168 furnished to do so, subject to the following conditions:
169
170 The above copyright notice and this permission notice shall be
171 included in all copies or substantial portions of the Software.
172
173 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
174 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
175 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
176 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
177 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
178 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
179 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
180 SOFTWARE.