GithubHelp home page GithubHelp logo

alanxz / rabbitmq-c Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rabbitmq/rabbitmq-c

1.7K 1.7K 658.0 3.18 MB

RabbitMQ C client

License: MIT License

Python 4.03% CMake 4.55% C 90.24% Shell 1.04% Dockerfile 0.14%
rabbitmq rabbitmq-client

rabbitmq-c's People

Contributors

0x34d avatar alanxz avatar bboozzoo avatar bkw avatar blarse avatar bodgit avatar dpw avatar epicads-scott avatar falzm avatar fladi avatar jesferman avatar johnhe4 avatar lockie avatar manchicken avatar mikes-spindance avatar mrtazz avatar msteinert avatar pinepain avatar piotrsikora avatar rcousens avatar remicollet avatar rpearl avatar sigiesec avatar svaningelgem avatar talih0 avatar thecount avatar tonyg avatar vs49688 avatar woldan avatar xgzeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rabbitmq-c's Issues

exchange.declare and alternative exchange

I'm having trouble determining if I can declare an exchange with alternative exchange. I'm using rabbitmq-c via some other language bindings, and attempting to pass an arguments table to amqp_exchange_declare with a key of "alternate_exchange" and a simple string value, but it never matches the precondition on the server which informs me that I've not passed an alternate-exchange value.

Is this possible?

Also, on the subject of exchange.declare and arguments, auto_delete is hidden in codegen.py?

Eugene

Missing rabbitmq.1.lib after installing

On Windows 7 machine with Visual Studio 2010 I did bellow given procedure (while running in VS command prompt). But in result I did not get the rabbitmq.1.lib where I expected.

  1. git clone https://github.com/alanxz/rabbitmq-c.git src
  2. cd src
  3. git submodule init
  4. git submodule update
  5. cd ..
  6. mkdir bin
  7. cd bin
  8. cmake -DCMAKE_INSTALL_PREFIX="../install/${BUILD_TYPE}" "../src"
  9. msbuild INSTALL.vcxproj > output-debug.txt
  10. msbuild INSTALL.vcxproj /p:Configuration=Release > output-release.txt

Everything seems fine. No error from neither cmake nor msbuild.

When I get (from bin where we are) to ../install there are Debug and Release sub-folders as expected for both builds ("installs"). And within those folders the structure is as expected, both contain sub-folders: bin, include and lib. Judging by .dll file sizes the installs indeed differ by Debug/Release.

The only issue is that lib folders (in both configurations) do not contain rabbitmq.1.lib! That .lib is present in bin folder where it was build but somehow it does not get copied during install.

Even the output from msbuild (output-debug.txt in this case) says:

PostBuildEvent:
  setlocal
  "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake
  if %errorlevel% neq 0 goto :cmEnd
  :cmEnd
  endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  :cmErrorLevel
  exit /b %1
  :cmDone
  if %errorlevel% neq 0 goto :VCEnd
  :VCEnd
  -- Install configuration: "Debug"
  -- Installing: C:/Library/rabbitmq-c/install/Debug/lib/pkgconfig/librabbitmq.pc
  -- Installing: C:/Library/rabbitmq-c/install/Debug/bin/rabbitmq.1.dll
  -- Installing: C:/Library/rabbitmq-c/install/Debug/include/amqp.h
  -- Installing: C:/Library/rabbitmq-c/install/Debug/include/amqp_framing.h

The rabbitmq.1.lib file is not even mentioned.

Why is it so?


By the way it would be nice if you could mention the ${BUILD_TYPE} trick in CMAKE_INSTALL_PREFIX. I didn't knew that and basically guessed that this might work after reading cmake_install.cmake

Another nice improvement would be to make the install script copy files for debugger (like the .pdb file) as well. (At least as an option.)

Compilation errors

OS: FreeBSD PRFT297 8.3-RELEASE-p3 FreeBSD 8.3-RELEASE-p3 #1: Fri Jun 22 17:34:45 UTC 2012 root@PRFT316:/usr/obj/usr/src/sys/Z-AMD64 amd64

got errors:

make

GEN librabbitmq/amqp_framing.h
Usage:
./librabbitmq/codegen.py <path_to_amqp_spec.json>... <path_to_output_file>
where is one of body, header
*** Error code 1

Stop in /usr/work/src/rabbitmq-c.

gmake

GEN librabbitmq/amqp_framing.h
GEN librabbitmq/amqp_framing.c
gmake all-am
gmake[1]: Entering directory /usr/work/src/rabbitmq-c' CC librabbitmq/librabbitmq_librabbitmq_la-amqp_api.lo In file included from ./librabbitmq/unix/socket.h:39, from librabbitmq/amqp_private.h:84, from librabbitmq/amqp_api.c:37: /usr/include/netinet/tcp.h:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'tcp_seq' /usr/include/netinet/tcp.h:50: error: expected specifier-qualifier-list before 'u_short' /usr/include/netinet/tcp.h:175: error: expected specifier-qualifier-list before 'u_int8_t' gmake[1]: *** [librabbitmq/librabbitmq_librabbitmq_la-amqp_api.lo] Error 1 gmake[1]: Leaving directory/usr/work/src/rabbitmq-c'
gmake: *** [all] Error 2

Made patch. Hope it will help you

# cat rabbit.patch 
PRFT297# cat rabbit.patch 
diff -Nru Makefile.am Makefile.am
--- Makefile.am 2012-09-06 13:29:37.000000000 +0400
+++ Makefile.am 2012-09-06 13:30:11.000000000 +0400
@@ -44,10 +44,10 @@
 amqp_codegen_json = $(top_srcdir)/codegen/amqp-rabbitmq-0.9.1.json

 librabbitmq/amqp_framing.h: $(amqp_codegen_json) $(codegen_py)
-       $(AM_V_GEN)PYTHONPATH=$(top_srcdir)/codegen $(PYTHON) $(codegen_py) header $< $@
+       $(AM_V_GEN)PYTHONPATH=$(top_srcdir)/codegen $(PYTHON) $(codegen_py) header $(top_srcdir)/codegen/amqp-rabbitmq-0.9.1.json $(top_srcdir)/librabbitmq/amqp_framing.h

 librabbitmq/amqp_framing.c: $(amqp_codegen_json) $(codegen_py)
-       $(AM_V_GEN)PYTHONPATH=$(top_srcdir)/codegen $(PYTHON) $(codegen_py) body $< $@
+       $(AM_V_GEN)PYTHONPATH=$(top_srcdir)/codegen $(PYTHON) $(codegen_py) body $(top_srcdir)/codegen/amqp-rabbitmq-0.9.1.json $(top_srcdir)/librabbitmq/amqp_framing.c

 AM_CFLAGS = -I$(top_srcdir)/librabbitmq

diff -Nru librabbitmq/amqp_api.c librabbitmq/amqp_api.c
--- librabbitmq/amqp_api.c      2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/amqp_api.c      2012-09-06 13:19:57.000000000 +0400
@@ -34,6 +34,8 @@
 #include "config.h"
 #endif

+#include "bartypes.h"
+
 #include "amqp_private.h"
 #include <assert.h>
 #include <stdarg.h>
diff -Nru librabbitmq/amqp_connection.c librabbitmq/amqp_connection.c
--- librabbitmq/amqp_connection.c       2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/amqp_connection.c       2012-09-06 13:19:57.000000000 +0400
@@ -34,6 +34,8 @@
 #include "config.h"
 #endif

+#include "bartypes.h"
+
 #include "amqp_private.h"
 #include <assert.h>
 #include <stdint.h>
diff -Nru librabbitmq/amqp_mem.c librabbitmq/amqp_mem.c
--- librabbitmq/amqp_mem.c      2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/amqp_mem.c      2012-09-06 13:19:57.000000000 +0400
@@ -34,6 +34,9 @@
 #include "config.h"
 #endif

+#include "bartypes.h"
+
+
 #include "amqp_private.h"
 #include <assert.h>
 #include <stdint.h>
diff -Nru librabbitmq/amqp_socket.c librabbitmq/amqp_socket.c
--- librabbitmq/amqp_socket.c   2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/amqp_socket.c   2012-09-06 13:19:57.000000000 +0400
@@ -34,6 +34,8 @@
 #include "config.h"
 #endif

+#include "bartypes.h"
+
 #include "amqp_private.h"
 #include <stdlib.h>
 #include <stdio.h>
diff -Nru librabbitmq/amqp_table.c librabbitmq/amqp_table.c
--- librabbitmq/amqp_table.c    2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/amqp_table.c    2012-09-06 13:19:57.000000000 +0400
@@ -34,6 +34,8 @@
 #include "config.h"
 #endif

+#include "bartypes.h"
+
 #include "amqp_private.h"
 #include <assert.h>
 #include <stdint.h>
diff -Nru librabbitmq/amqp_url.c librabbitmq/amqp_url.c
--- librabbitmq/amqp_url.c      2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/amqp_url.c      2012-09-06 13:19:57.000000000 +0400
@@ -34,6 +34,8 @@
 #include "config.h"
 #endif

+#include "bartypes.h"
+
 #include "amqp_private.h"
 #include <stdint.h>
 #include <stdio.h>
diff -Nru librabbitmq/bartypes.h librabbitmq/bartypes.h
--- librabbitmq/bartypes.h      1970-01-01 03:00:00.000000000 +0300
+++ librabbitmq/bartypes.h      2012-09-06 13:14:03.000000000 +0400
@@ -0,0 +1,6 @@
+/* BART */
+#include <sys/types.h>
+#include <stdint.h>
+typedef ushort u_short;
+typedef uint8_t u_int8_t;
+/* BART END */
diff -Nru librabbitmq/unix/socket.c librabbitmq/unix/socket.c
--- librabbitmq/unix/socket.c   2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/unix/socket.c   2012-09-06 13:14:55.000000000 +0400
@@ -34,6 +34,7 @@
 #include "config.h"
 #endif

+#include "../bartypes.h"
 #include "amqp_private.h"
 #include "socket.h"
 #include <fcntl.h>
diff -Nru librabbitmq/unix/socket.h librabbitmq/unix/socket.h
--- librabbitmq/unix/socket.h   2012-09-06 13:29:37.000000000 +0400
+++ librabbitmq/unix/socket.h   2012-09-06 13:27:12.000000000 +0400
@@ -33,6 +33,9 @@
  * ***** END LICENSE BLOCK *****
  */

+#include "../bartypes.h"
+
+
 #include <errno.h>
 #include <netdb.h>
 #include <netinet/in.h>

Error in configure file

When I follow the directions here:

http://us1.php.net/manual/en/amqp.installation.php

a faulty "configure" file is created.

Specifically, on MacOSX 10.7.5, the command:

autoreconf -i (or "aclocal && autoreconf -i" as suggested in the contributed notes)

produces a "configure" file that has at least one syntax error
in it -- a malformed "case" statement on line 12600.

Line 12600 and then some:

case " $CFLAGS " in
  *\ \  -m64\ \ *
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

    { echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
        CFLAGS=$_ax_cflags

fi

rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 : ;;
  *) CFLAGS="$CFLAGS -m64" ;;
esac

Create packaging

Creating packaging so that the packages can be distributed as an RPM, DEB, NSIS, tarball etc.

Mac OS Install Issues

Command:
autoreconf -i

Result:
glibtoolize: putting auxiliary files in .'. glibtoolize: copying file./ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, m4'. glibtoolize: copying filem4/libtool.m4'
glibtoolize: copying file m4/ltoptions.m4' glibtoolize: copying filem4/ltsugar.m4'
glibtoolize: copying file m4/ltversion.m4' glibtoolize: copying filem4/lt~obsolete.m4'
configure.ac:69: error: possibly undefined macro: AS_IF
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:92: error: possibly undefined macro: AC_PATH_PROGS_FEATURE_CHECK
configure.ac:97: error: possibly undefined macro: AC_MSG_RESULT

Command:
./configure

Result:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking build system type... i386-apple-darwin11.4.0
checking host system type... i386-apple-darwin11.4.0
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.4.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc option to accept ISO C99... -std=gnu99
checking host system type... (cached) i386-apple-darwin11.4.0
checking whether byte ordering is bigendian... no
checking for inline... inline
checking if compiler accepts '-Wall'... yes
checking if compiler accepts '-Wextra'... yes
checking if compiler accepts '-pedantic'... yes
checking if compiler accepts '-Wstrict-prototypes'... yes
checking if compiler accepts '-Wcast-align'... yes
checking if compiler accepts '-fno-common'... yes
checking if compiler accepts '-fvisibility=hidden'... yes
checking if linker accepts '-no-undefined'... yes
./configure: line 12529: syntax error near unexpected token newline' ./configure: line 12529: *\ \ -m64\ \ *'

How to use in xcode?

I have succesfully build this on osx, but how do I use it in my own xcode projects?

Any way to detect a socket being closed by the server in between library calls?

Is there a way of reliably finding out if a server connection is still established?

For my tests I established a connection, let the client sleep and in the meantime shut down the broker. Then I tried sending an empty write to the socket, or using getpeername() on it, to find out whether I could still use it. But I can't seem to get decisive results (on OSX, that is), and errno does not get set.

Could clients just send a heartbeat frame out of the blue? Would that work? Any ideas?

comuser pull api

I can not find the consumer pull api in rabbitmq-c, does this lib have this api?

win32 build fails on visual 2008

hi, i'm getting a bunch of build errors on vs 2008, mostly cast errors (return from alloc, etc), is vs supported or is it getting phased out like a lot of other projects?

Channel based memory management

Make it possible to release memory on a per-channel basis. Allowing for clients that use multiple channels to make better use of memory.

Setup coding standard

Set up coding standards, and a way to enforce it for new code:

  • Indent is 2 spaces
  • naming conventions
  • bracing style
  • wrap at 80 characters?

etc.

Libtool library used but `LIBTOOL' is undefined

I'm getting an error when I run autoconf.

[~/rabbitmq-c]$ autoreconf -i
Makefile.am:5: Libtool library used but `LIBTOOL' is undefined
Makefile.am:5: 
Makefile.am:5: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
Makefile.am:5: to `configure.ac' and run `aclocal' and `autoconf' again.
Makefile.am: C objects in subdir but `AM_PROG_CC_C_O' not in `configure.ac'
autoreconf: automake failed with exit status: 1

I'm running CentOS 5.8 64-bit, with libtool 1.5.22 and autoreconf 2.59. I've just cloned the latest version of rabbitmq-c.

problem with amqp_simple_wait_frame call

This functions works perfect if interchange is active.

But if we put message into queue after approximately 2 hours of waiting it doesn't see this message.

What can be wrong?

Static Library for iOS

How do i create a static library for ios from this? I did a cmake -GXcode on the the source folder, but it generates a mac osx target xcode project.

When i change the project target to ios and set everything to static library in the target, i get compile errors:
target specifies product type 'com.apple.product-type.library.dynamic', but there's no such product type for the 'iphonesimulator' platform. So i figured it still wants to cmake a dynamic library

Can't i tell cmake to make a static xcode project for it, since ios platform won't allow for dynamic libraries it seems.

greets

Error: Libtool library used but `LIBTOOL' is undefined

keep getting the error, seen that upgrading might fix it but again creates same issue:

$ autoreconf -i
configure.ac: installing ./install-sh' configure.ac: installing./missing'
configure.ac:38: installing ./config.guess' configure.ac:38: installing./config.sub'
Makefile.am:5: Libtool library used but LIBTOOL' is undefined Makefile.am:5: Makefile.am:5: The usual way to defineLIBTOOL' is to add AC_PROG_LIBTOOL' Makefile.am:5: toconfigure.ac' and run aclocal' andautoconf' again.
Makefile.am: C objects in subdir but AM_PROG_CC_C_O' not inconfigure.ac'
Makefile.am: installing ./compile' Makefile.am: installing./depcomp'
autoreconf: automake failed with exit status: 1

$ autoreconf -V
autoreconf (GNU Autoconf) 2.64

make error

@alanxz ,Hi~
when i ./configure, throw a error:

./configure: line 4161: syntax error near unexpected token 2.2' ./configure: line 4161:LT_PREREQ(2.2)'

ps:
OS:fedora 17 x86_64

SSL/TLS Support

Support AMQP over SSL/TLS:

http://www.rabbitmq.com/ssl.html

From an email with Jeff on 4/24:

If I understand that page correctly AMQP over TLS/SSL, a client would open a socket to the broker, negotiate the TLS/SSL connection, the assuming that succeeded, then AMQP protocol would continue as it usually does over the TLS/SSL socket.

Given the above assumptions, here's what I'd do to get rabbitmq-c to support TLS/SSL:

  • Pick a TLS/SSL library.
    A quick search on the net gives me two options:
    ++ OpenSSL - BSD licensed, but large (in terms of code size)
    ++ CyaSSL - GPLv2, smaller and suitable for embedded environments
  • Augment the rabbitmq-c API so that users of the library could hand it an TLS/SSL socket (see amqp_get_sockfd() and amqp_set_sockfd()).
    ++ I would let the client code figure out how to handle negotiating the TLS/SSL socket correctly
    ++ Internally we'd have to create a method to use the correct open() read(), write(), writev(), and close(), depending on whether the connection was over a TLS connection or not, and handle potential errors from the TLS/SSL library.

So my assessment is that this isn't an impossible task, nor one that would take a huge amount of time.

Another option would be to tunnel the AMQP though an SSH connection, which would not require any changes to the rabbitmq-c library at all, though would require a ssh client on the client, and some setup and a ssh server on the broker end of things.

dh_install: librabbitmq-dev missing files (debian/tmp/usr/lib/*.a), aborting

When attempting to build the debian packages on Ubuntu Precise 12.04 64bit the build fails when attempting to build the librabbitmq-dev package:

Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: "Release"
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/lib/pkgconfig/librabbitmq.pc
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/lib/librabbitmq.so
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/include/amqp.h
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/include/amqp_framing.h
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/share/man/man1/amqp-consume.1
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/share/man/man1/amqp-declare-queue.1
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/share/man/man1/amqp-delete-queue.1
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/share/man/man1/amqp-get.1
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/share/man/man1/amqp-publish.1
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/share/man/man7/librabbitmq-tools.7
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-publish
-- Removed runtime path from "/home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-publish"
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-get
-- Removed runtime path from "/home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-get"
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-consume
-- Removed runtime path from "/home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-consume"
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-declare-queue
-- Removed runtime path from "/home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-declare-queue"
-- Installing: /home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-delete-queue
-- Removed runtime path from "/home/davewongillies/src/git/rabbitmq-c/debian/tmp/usr/bin/amqp-delete-queue"
make[1]: Leaving directory `/home/davewongillies/src/git/rabbitmq-c/obj-x86_64-linux-gnu'
   dh_install
dh_install: librabbitmq missing files (debian/tmp/usr/lib/*.so.*), aborting
make: *** [install-stamp] Error 255
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

It seems during the build process it doesn't build any of the files requires for the librabbitmq-dev package.

SIGPIPE causes process exit on Linux

When the broker drops the TCP connection to the client in an unclean manner, and rabbitmq-c tries to send(), the process gets a SIGPIPE which by default causes the process to exit.

This only occurs on Linux and other platforms that have this behavior in the send() function.

A workaround would be to set up an signal handler for SIGPIPE that swallows the error

The fix should be to set MSG_NOSIGNAL in the flag when calling send()

Provide a high-level consumer API

Provide a high-level API for consuming messages. Having to deal with individual frames doesn't fit well with the rest of the library.

This will require thinking about how do deal with threads or an internal or external event loop.

Asynchronous api?

We would like to avoid threads in our app, but we have a need to respond to external events quickly even when the rabbitmq server is or becomes unreachable. Since the existing functions seem to require the calling thread to block in many cases, I don't see a way to do this without introducing a new thread.

Is there any plan to address this issue?

Thanks.

#ifdef DISABLE_SIGPIPE_WITH_SETSOCKOPT bug in amqp_socket.c

Sudhakar P reports:

It appears that in one of your recent changes to amqp_socket.c, line
86 has been changed from

#ifdef DISABLE_SIGPIPE_WITH_SETSOCKOPT

to

#if DISABLE_SIGPIPE_WITH_SETSOCKOPT

This leads to compilation error as this flag doesn't get defined in my
environment.

Fix should be to change that back to an #ifdef and not an #if

IPv6 support

rabbitmq-c currently lacks IPv6 smarts so AMQP connections are IPv4-only.

From a quick glance it should only really require sprinkling some getaddrinfo() & AF_INET6 magic in amqp_open_socket().

An error with compiling, need help...

[[email protected] bin-rabbitmq]$ cmake ../rabbitmq-c
-- The C compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PythonInterp: /home/liangdong/libs/bin/python2.7
-- Using amqp_codegen.py in /home/liangdong/rabbitmq-c/codegen
-- Found POPT
-- Configuring done
-- Generating done
-- Build files have been written to: /home/liangdong/bin-rabbitmq
[[email protected] bin-rabbitmq]$ make
[ 2%] Generating amqp_codegen.py
[ 4%] Generating codegen.py
[ 6%] Generating amqp_framing.h
[ 8%] Generating amqp_framing.c
Scanning dependencies of target rabbitmq
[ 10%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_framing.c.o
[ 12%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_api.c.o
[ 14%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_connection.c.o
[ 16%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_mem.c.o
[ 18%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_socket.c.o
[ 20%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_table.c.o
[ 22%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_url.c.o
[ 24%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/unix/socket.c.o
Linking C shared library librabbitmq.so
[ 24%] Built target rabbitmq
Scanning dependencies of target amqp_bind
[ 26%] Building C object examples/CMakeFiles/amqp_bind.dir/amqp_bind.c.o
[ 28%] Building C object examples/CMakeFiles/amqp_bind.dir/utils.c.o
[ 30%] Building C object examples/CMakeFiles/amqp_bind.dir/unix/platform_utils.c.o
Linking C executable amqp_bind
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0xae): In function main': : undefined reference toamqp_new_connection'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0xbb): In function main': : undefined reference toamqp_open_socket'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0xd5): In function main': : undefined reference toamqp_set_sockfd'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x110): In function main': : undefined reference toamqp_login'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x15a): In function main': : undefined reference toamqp_channel_open'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x16a): In function main': : undefined reference toamqp_get_rpc_reply'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x1af): In function main': : undefined reference toamqp_cstring_bytes'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x1c7): In function main': : undefined reference toamqp_cstring_bytes'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x1df): In function main': : undefined reference toamqp_cstring_bytes'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x1f1): In function main': : undefined reference toamqp_empty_table'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x200): In function main': : undefined reference toamqp_empty_table'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x243): In function main': : undefined reference toamqp_queue_bind'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x250): In function main': : undefined reference toamqp_get_rpc_reply'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x298): In function main': : undefined reference toamqp_channel_close'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x2db): In function main': : undefined reference toamqp_connection_close'
CMakeFiles/amqp_bind.dir/amqp_bind.c.o(.text+0x314): In function main': : undefined reference toamqp_destroy_connection'
CMakeFiles/amqp_bind.dir/utils.c.o(.text+0x27): In function die_on_error': : undefined reference toamqp_error_string'
CMakeFiles/amqp_bind.dir/utils.c.o(.text+0xd5): In function die_on_amqp_error': : undefined reference toamqp_error_string'
collect2: ld returned 1 exit status
make[2]: *** [examples/amqp_bind] Error 1
make[1]: *** [examples/CMakeFiles/amqp_bind.dir/all] Error 2
make: *** [all] Error 2

diference between amqp_basic_consume and amqp_basic_get

i'm confused with two apis.
ai i know, consumer will allocate a thread pool by default to listen the msg.
but according to the examples,i see while (1) instead.i think i can use amqp_basic_get to substitute amqp_basic_consum
so i want to know ,in rabbitmq-c, what's the key difference between amqp_basic_get and amqp_basic_consume.

autotools: --enable-64-bit doesn't work consistently

The --enable-64-bit autoools configure script flag doesn't work consistently on systems where the compiler generates 64-bit executables by default. The output of the configure script indicates 32-bit executables are built when in reality 32-bit object code is generated.

The fix here needs to take into account the following

  • Take the position of least surprise. If the compiler builds 64-bit by default we should do that. If the configure script says its going to compiler it a certain way, it should do that.
  • There's not a good clean way to detect what a compiler does by default (e.g., OpenVMS 64-bit executables can have both short (32-bit) and long pointers (64-bit) running around in the same address space)
  • We don't know what flags to pass to all compilers to force a compiler to build in 32 or 64-bit mode (e.g., what do we pass to SunStudio, IBM XL, or HP aCC?)

Thus I think the fix needs to be:

  • By default (e.g., nothing passed into ./configure, and an empty CFLAGS variable) it should default to whatever the compiler does
  • If a CFLAGS variable is set in the environment used to run configure it should be honored
  • The ./configure provides two mutually exclusive flags --force-32-bit and --force-64-bit which will override the first two conditions above and force the library to be built, but only when we know what flag to pass to the compiler to force it to be built a certain way.

Sort out building under cygwin

Sort out building under cygwin:

  • autoconf/i686-pc-cygwin
  • autoconf/i686-w64-mingw32
  • cmake/i686-pc-cygwin
  • cmake/i686-w64-mingw32

Rabbitmq-c hangs after ip change

If I start rabbitmq-c client, connect successfully and change IP address of the machine, rabbitmq-c will hang before exiting.

Easiest way to reproduce:

Let's assume:

  • Broker on 192.168.2.100
  • rabbitmq-c on 192.168.2.3

Start example:

./amqp_producer 192.168.2.100 5672 1 30

Then before it exits, change IP of rabbitmq-c to 192.168.2.4.

If you change IP, while producer is running, example will hang on line:

die_on_amqp_error(amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS), "Closing channel");

Without IP change, it exits immediatelly. So I think it's a bug.

Incorrect description in README for compilation?

Hi,

I've just compiled your library, following step-by-step guide from README, using CMake.
It looks like there are couple of incorrect things (at least for my system).

  1. For Windows, the suggestion is to run "nmake" or "msbuild". None of them works for me - nmake tells that there is no makefile, and msbuild tells some message and exists. It refers to "vcbuild" instead, running which without arguments, I was able to compile.
  2. The executables for the examples are in slightly different folders. I had sub-folders Release, Debug and some others under "examples", where the .exe files were located. This is minor.
  3. It might be worth to note that before running examples, there should be a queue service running in the system. I'm new to that things, so for me it was not that evident from the "Opening socket: ..." error (after listener start), why socket can't be opened on the localhost, and it took some time to realize the cause. Simple hint would be of great help - either in README, or directly in the example - it could report directly that queue service is not started.

Thanks!

amqp_table_t and high availability config params

I am stuck with a double free corruption when using rabbitmq-c with high availability configuration. For HA, since the nodes names have to be taken from a config file, I have implemented the following way of getting the key value params.

   amqp_table_t table;
   std::vector<amqp_field_value_t_ *> array_ptrs;

   memset(&table, 0, sizeof(table));
   table.num_entries = ha_map.size();
   if (table.num_entries)
       table.entries = (amqp_table_entry_t *) calloc(1, sizeof(amqp_table_entry_t) * table.num_entries);
   int i = 0;

   std::map<std::string, std::vector<std::string> >::const_iterator it;
   for (it = ha_map.begin(); it != ha_map.end(); it++, i++) {
      table.entries[i].key.len = (*it).first.size();
      table.entries[i].key.bytes = (void *) (*it).first.c_str();

      if ((*it).second.size() == 1) {
         table.entries[i].value.kind = AMQP_FIELD_KIND_UTF8;
         table.entries[i].value.value.bytes.len = (*it).second[0].size();
         table.entries[i].value.value.bytes.bytes = (void *) (*it).second[0].c_str();

      } else if ((*it).second.size() > 1) {
         table.entries[i].value.kind = AMQP_FIELD_KIND_ARRAY;
         table.entries[i].value.value.array.num_entries = (*it).second.size();
         amqp_field_value_t *f = (amqp_field_value_t_ *) malloc(sizeof(amqp_field_value_t_) * (*it).second.size());
         array_ptrs.push_back(f);
         table.entries[i].value.value.array.entries = f;
         LogInfo(("Before pointer: %p", table.entries[i].value.value.array.entries));
         for (size_t j = 0; j < (*it).second.size(); j++) {
            table.entries[i].value.value.array.entries[j].kind = AMQP_FIELD_KIND_UTF8;
            table.entries[i].value.value.array.entries[j].value.bytes.len = (*it).second[j].size();
            table.entries[i].value.value.array.entries[j].value.bytes.bytes = (void *) (*it).second[j].c_str();
         }
         LogInfo(("Before1 pointer: %p", table.entries[i].value.value.array.entries));
      }
   }

   amqp_queue_declare_ok_t *r =
      amqp_queue_declare(m_conn, m_channel, amqp_cstring_bytes(m_queue.c_str()), 0, 1, 0, 0, table);

   for (size_t i = 0; i < array_ptrs.size(); i++) {
      free(array_ptrs[i]);
   }
   free(table.entries);

This works perfectly fine. But the crash happens when I replace

   for (size_t i = 0; i < array_ptrs.size(); i++) {
      free(array_ptrs[i]);
   }

with

   for (int k = 0; k < table.num_entries; k++) {
       free(table.entries[k].value.value.array.entries);
   }

Is this a bug or am I doing something wrong?

configure incorrectly errors if the python json module is unavailable, but simplejson is availabe

As far as I can tell, if you attempt to configure with an older version of python (with simplejson, but not json, available) then the configuration script fails as follows:

checking python module: json... no
configure: error: failed to find required module json

This is because configure.ac incorrectly claims that the lack of the json module is a fatal error, so the check below for simplejson never runs.

Syntax error while making librabbitmq

Hi, I can't build librabbitmq on my Archlinux neither with autoreconf nor with cmake. In both cases I get the same syntax error:

~/tmp/bin-rabbitmq-c > make
[ 2%] Generating amqp_codegen.py
[ 4%] Generating codegen.py
[ 6%] Generating amqp_framing.h
File "/home/yutas/tmp/bin-rabbitmq-c/librabbitmq/codegen.py", line 50
print self.prefix + line
^
SyntaxError: invalid syntax
make[2]: *** [librabbitmq/amqp_framing.h] Error 1
make[1]: *** [librabbitmq/CMakeFiles/rabbitmq.dir/all] Error 2
make: *** [all] Error 2

I have python 3.2.3 and python-simplejson 2.5.2-1 installed. What may be wrong?

some questions - non-blocking in consume and possibility use on other unix variants

We have 2 question about the rabbitmq-c

  1. Is it possible to get the value of amqp_data_in_buffer when we implement the consume. We want to make a non-blocking procedure and to be able to do these we need to check the value from amqp_data_in_buffer but it is always returning 0.

  2. Is it possible to use the rabbitmq-c in AIX, HP-Unix and Solaris installation

Does library compile on Solaris 8?

Hi,

Does this library compile on Solaris 8? Current setup:

SunOS 5.8 sparc SUNW,SPARC-Enterprise-T5220

Using autoreconf (GNU Autoconf) 2.65, cmake version 2.8.6, python 2.6.2 with simplejson.

I get compile errors similar to: http://ppm4.activestate.com/sun4-solaris/5.10/1000/J/JE/JESUS/Net-RabbitMQ-0.1.0.d/log-20100118T050925.txt

A bunch of syntax errors:

gmake[2]: Circular librabbitmq/codegen.py <- librabbitmq/codegen.py dependency dropped.
gmake[2]: Circular librabbitmq/codegen.py <- librabbitmq/codegen.py dependency dropped.
[ 2%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_framing.c.o
"/data/tmp/rabbitmq-c/librabbitmq/amqp.h", line 131: warning: no explicit type given
"/data/tmp/rabbitmq-c/librabbitmq/amqp.h", line 131: syntax error before or at: amqp_method_number_t
"/data/tmp/rabbitmq-c/librabbitmq/amqp.h", line 131: warning: old-style declaration or incorrect type for: amqp_method_number_t
"/data/tmp/rabbitmq-c/librabbitmq/amqp.h", line 133: warning: no explicit type given
"/data/tmp/rabbitmq-c/librabbitmq/amqp.h", line 133: syntax error before or at: amqp_channel_t
.
.
.
.

Thanks

Interrupting library calls

I'm not sure this is a good place to ask (most likely not). But I don't know any better place (a feature I miss in github) and quick browsing through the code makes me think this might not be possible at all and thus would be an "issue" in fact.

So is there a way to interrupt library calls?

For library user it would be useful to be able to interrupt any calls that could take long (in particular those which block execution until some input on a socket). And keep consistency and stability of the data/library so any actions could be (as much as possible) taken again without complete reload.

autoreconf -i fails

On RHEL5:

07:38:59 ~/Programs/rabbitmq-c$ autoreconf -iv
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
configure.ac:60: error: possibly undefined macro: AS_CASE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:69: error: possibly undefined macro: AS_IF
configure.ac:92: error: possibly undefined macro: AC_PATH_PROGS_FEATURE_CHECK
configure.ac:97: error: possibly undefined macro: AC_MSG_RESULT
configure:2907: error: possibly undefined macro: m4_foreach_w
autoreconf: /usr/bin/autoconf failed with exit status: 1
07:39:06 ~/Programs/rabbitmq-c$

amqp_abort() when connecting to qpid broker

Get rid of amqp_abort() functions when getting unexpected data from the broker, especially when connecting to a broker we don't support (like qpid).

Instead of causing the whole program to abort, the expected behavior should be:

  • close the socket immediately
  • report an error to the caller

issue compiling rabbitmq-c on mac osx

Hello there,
Thanks for all the great job done here. Anyway I cant get to compile the lib on my mac.
this is the output error i got:

./configure: line 12334: syntax error near unexpected token newline' ./configure: line 12334: *\ \ -m64\ \ *'

im running os x 10.6.8
Xcode 3.2.6
Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518
gcc version: i686-apple-darwin10-gcc-4.2.1

Any help would be great, thank you.

el-cheapo heartbeat handling?

I wonder what you think about adding very basic support for responding to heartbeat frames in amqp_simple_wait_method or amqp_simple_wait_frame (or wherever is the more appropriate place)?

I'm fully aware that this is not the proper fix (separate thread would be needed and all), but it would work in situations where the only connections that are idle for a long time are consumers sleeping in basic.consume. This happens to be the majority of my use cases anyway.

With Rabbitmq 3+ enabling heartbeats by default and user reports of problems with long running connections this might be low hanging fruit mitigating the problem, until a real solution comes along.
I would love to hear your thoughts on this, @alanxz . If you give the go ahead, I might (might!) start hacking on this.

Static library

Is it possible to build and use this library as static library rather than dynamic library?

The dynamic library seems to be what you get by default (at least on Windows/Visual Studio). However for various reasons I would prefer a static library (mostly due to easier use and setup of resulting .exe).

Are there any options I should specify to make it work that way? If so then what are they?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.