Commit Graph

253 Commits

Author SHA1 Message Date
Matt Broadstone 84746ff77c handle messages with empty payloads
If a message is delivered with an empty body, we were not previously
enqueuing the message. This fixes issue #43
2014-09-10 22:39:13 -04:00
Matt Broadstone 6a3d355de2 rename amqp_ files to qamqp
amqp_<filename> is used in at least two other C/C++ projects related
to amqp, so this commit changes all our source to use a qamqp header.
This avoids potential clashes, and is more in line with Qt style
2014-08-26 15:05:39 -04:00
Matt Broadstone 840efb037d refactor Frame::Content to use Message::Property 2014-08-26 14:45:50 -04:00
Matt Broadstone bdd9bae8ea refactor ValueType
moved ValueType from the QAMQP namespace to QAMQP::MetaType namespace
to avoid clashes with very generic enum strings
2014-08-26 14:02:43 -04:00
Matt Broadstone 0ccb3035cd move QAMQP::Frame to private API
QAMQP::Frame used to be public API mostly for MessageProperties. There
is no longer a need to keep this API public, as it should all be wrapped
with the cleaner Message/Queue/Exchange/Client API set
2014-08-26 09:57:08 -04:00
Matt Broadstone 0bc1c32bd8 add test for sharing a channel
Though it's not necessarily recommended (per spec), Channels can be
shared by multiple Exchanges and Queues. I've added a test here showing
that's possible with QAMQP
2014-08-08 17:09:52 -04:00
Matt Broadstone 870af7b5d4 split channel tests into their own executable
Refactored tests specific to QAMQP::Channel into its own full test
case, as there are more on the way
2014-08-08 17:09:51 -04:00
Matt Broadstone baa5c1de3e refactor Channel::channelClose to just Channel::close 2014-08-08 17:09:51 -04:00
Matt Broadstone 695f7d2997 complete close handshakes properly for Client and Channel
We had frame handlers for Close messages from the server, but were not
doing our due diligence and sending a corresponding CloseOk back to the
server after processing. It seems RabbitMQ is generous in this case, but
at least we're doing it the right way now
2014-08-07 14:12:28 -04:00
Matt Broadstone 1ebe3bd667 implement flow frame handling support
Fleshed out the previously unimplemented flow control frame handling,
added an auto test for it. Also refactored out the stateChanged ChannelPrivate
method, if we need proper state support in the future it will be added with
a better implementation
2014-08-07 13:52:09 -04:00
Matt Broadstone 6291bb7f42 add auto test for channel close
improve code coverage for tests by including a test for Channel::closeChannel
to both Exchange and Queue test suites
2014-08-06 22:35:46 -04:00
Matt Broadstone bb2e9881ea short strings are latin1 encoded not utf8 2014-08-05 15:45:25 -04:00
Matt Broadstone 3ce39c273f use compatible type max definitions
UINT8_MAX/UINT16_MAX only work on osx and glibc builds with certain
defines.
2014-08-05 15:28:19 -04:00
Matt Broadstone fdb8dddc14 initialize network variables
there were a number of variables copied over from the legacy Network
class that were not properly initialized.
2014-08-05 14:38:13 -04:00
Matt Broadstone d5cc6258c6 refactor type handling in QAMQP
There are two distinctive type sets in AMQP, the basic AMQP types
and then the superset of Table value types. This commit attempts to
make that distinction more clear by the addition of a Table class.
Basically, AMQP value type read/write support is left in Frame for the
time being, while table value field read/write support has been moved
to the Table class. Also, a number of type differences exist between
the spec and rabbitmq's binary parser (noted in the errata page) which
were not previously honored.
2014-08-05 14:34:12 -04:00
Matt Broadstone 4ea3bdb851 don't store content message in Content frame
the message was being needlessly duplicated into the Content frame,
now we only store the size there to be sent out, rather than the whole
message

remove QAMQP prefix in authenticator
2014-08-05 14:34:03 -04:00
Matt Broadstone 77134f0279 frame cleanup
removed crufty code, improve test coverage
2014-07-29 13:35:01 -04:00
Matt Broadstone 1083f4db3a test delayed queue bindings
improve code coverage by adding a test for delayed declaration and
bindings of queues. also uncovered a bug with disconnectFromHost in
Client
2014-07-29 12:57:15 -04:00
Matt Broadstone 75f7882d1c update flakey get test 2014-07-28 17:55:30 -04:00
Matt Broadstone fa132d7c72 guarantee frames are written
wait for the END frame to be written, guaranteeing that data will
be written when you think it has been.
2014-07-28 11:36:52 -04:00
Matt Broadstone 5d00b2a068 add accessors for custom headers
Moved from direct access to a Frame::TableField to accesors to that
data. More readable/useable api for this data.
2014-07-21 17:08:13 -04:00
Matt Broadstone 5c6cd23e10 move property definition/access to Message
MessageProperties is currently defined in Frame::Content, which makes it
cumbersome to use when working directly with a Message itself. I attempted
to make this easier by using typedefs, but it's become pretty obvious that
it belongs in the Message class itself.
2014-07-21 16:54:12 -04:00
Matt Broadstone dec9ef72d3 added test for invalid routing keys
also added a debug message for attempts to write shortstr's greater
than acceptable length.
2014-06-30 18:42:39 -04:00
Matt Broadstone a89dbb3805 add tests for proper uri validation
this is the missing component from PR #41, tests a number of example
amqp uri's provided by the RabbitMQ spec/documentation
2014-06-26 16:05:47 -04:00
Matt Broadstone 12a03f959f add qos support to channel
AMQP Basic qos support added to Channel class. There is an option
for global qos which is currently not added. Also, added auto tests
for qos definition, proper qos operation and verifying that RabbitMQ
does not support prefetchSize.
2014-06-26 10:28:58 -04:00
Matt Broadstone 824d8d56ca add PR #41
vhosts can't start with a /
2014-06-24 21:35:58 -04:00
Matt Broadstone b662fd6557 fix issue #33
AMQP_BASIC_CONTENT_ENCODING_FLAG and AMQP_BASIC_MESSAGE_ID_FLAG were
switched
2014-06-24 21:26:22 -04:00
Matt Broadstone e94f372cfe clean up QAMQP::Queue api
removed noAck as it relates only to the synchronous get AMQP api
moved noAck to get method
applied visual separation in headers between AMQP Queue and AMQP Basic methods
2014-06-24 21:09:45 -04:00
Matt Broadstone cab23c97cc add support for cancelling a consumer
cancel method and cancelled signal added to Queue, added auto tests
to guarantee conditions surrounding the cancel process
2014-06-24 11:09:19 -04:00
Matt Broadstone c43c2d6788 ensure consuming only occurs once per queue
a Queue can act as a consumer in QAMQP, but previously we did no checks
to ensure that a Queue sent a request to consume only once. This commit
adds API for checking and ensuring that this is the case. Also, I reverted
the changes to allow multiple consumer tags because this was incorrect.
Also included is a new signal "consuming" to notify when consumption occurs,
and auto tests have been updated to use this, as well as verify that it
can only occur once per-consumer
2014-06-24 10:30:05 -04:00
Matt Broadstone 4f808bef92 add publish options
- add publish options to Exchange (these need to move to a Basic abstraction)
- listen for bmReturn in Exchange to catch errors
- added auto tests to check behavior of an invalid mandatory publish
- cleaned up bit fields in exchange and queue
2014-06-23 15:36:03 -04:00
Matt Broadstone cb52911bed additional peer exceptions added
added a few cases where we should be raising peer exceptions when
delivered invalid frames from the server (per spec)
2014-06-19 13:36:11 -04:00
Matt Broadstone 1ae43ef4bd change the way messages are received
Messages used to be "delivered" and pushed right onto the queue, which
is where the requirement for Message to be explicitly shared came from.
Now messages that are incomplete come in and are stored in a "currentMessage"
private member (there is a requirement that messages are delivered in this
fashion, by the spec). Once the message body has come in, it is put into
the local queue and the messageReceived signal is emitted.

Also, modified Queue to be able to track a number of consumer tags. This
was exposed by the "routing" tutorial, where a single consumer can bind
to a number of exchanges with a generated consumer tag. The previous example
did not run into this problem because it used an explicitly set consumer tag
and therefore there were no conflicts.
2014-06-19 10:01:47 -04:00
Matt Broadstone bf21ebc246 refactor Message
message now provides an "isValid" property, data is implicitly shared now
2014-06-19 10:00:52 -04:00
Matt Broadstone b5d77e17e3 revert reordering publish arguments
I originally changed the publishing arguments to take a routingKey first
which is pretty nonstandard across implementations. Reverting for
conformity.
2014-06-17 15:14:23 -04:00
Matt Broadstone 352669f392 added all tests around exchange declaration 2014-06-11 15:49:05 -04:00
Matt Broadstone 4a09094140 added autotest for invalid exchange declarations 2014-06-11 14:38:42 -04:00
Matt Broadstone 496e00abb9 move error constants to global namespace 2014-06-11 13:44:30 -04:00
Matt Broadstone c2dad7d6bb added RemoveOptions to Exchange, remove auto deletion (this should be handled by the AutoDelete option), and added
a test for an invalid remove(roIfUnused)
2014-06-10 21:41:28 -04:00
Matt Broadstone 8e2b66677d add roForce to Queue, replace forceRemove 2014-06-10 21:27:59 -04:00
Matt Broadstone 566de2e4d4 spelling cleanups 2014-06-10 21:23:08 -04:00
Matt Broadstone 46e974aeb8 provide purged signal, other small cleanups 2014-06-10 13:04:57 -04:00
Matt Broadstone 4ff7683536 standardize MessageProperties throughout codebase 2014-06-10 09:16:04 -04:00
Matt Broadstone 4422924219 convert QAMQP::Queue to a proper QQueue subclass, move MessageProperties to QAMQP namespace 2014-06-10 09:05:42 -04:00
Matt Broadstone 55da181788 a little closer to proper tuning 2014-06-09 19:39:09 -04:00
Matt Broadstone 1510e1f6c6 provide access to tuning variables, add checks for frameMax per spec in a number of areas,
add an incomplete autotest for using connection tuning parameters
2014-06-09 19:27:24 -04:00
Matt Broadstone 223af56683 use consistent naming scheme for constants 2014-06-09 19:26:30 -04:00
Matt Broadstone 1d3f53ba60 clear buffer on forced disconnect, fatal disconnect on bad frame end, store tuning parameters 2014-06-09 16:01:23 -04:00
Matt Broadstone 613bd5ba96 make sure all errors have Error in the name 2014-06-09 15:10:22 -04:00
Matt Broadstone 50a588e678 allow for creation of a queue with no name, added auto test for validation 2014-06-09 14:07:13 -04:00
Matt Broadstone 60167321a9 add test for incompatible authentication mechanisms 2014-06-06 16:49:45 -04:00
Matt Broadstone bea9204824 added qAmqpDebug to reduce debug messages during testing 2014-06-06 13:46:08 -04:00
Matt Broadstone 8599cec147 - added auto tests for binding to standard AMQP-defined exchanges
- removed name parameter from Queue::declare, reducing confusion. Updated manual test to reflect this change
2014-06-06 13:37:36 -04:00
Matt Broadstone 9b45f2ac58 - added auto tests for remove
- remove now takes flags rather than magical booleans
- fixed a bug delete -> deleteOk in QueuePrivate so we can listen for sync queue destruction
- added error signals to Client(Connection), and Channel
- removed automatic calls to remove a Queue when the channel is closed, or Queue is deleted
  this behavior is already handled by the AutoDelete declare option
2014-06-06 12:10:51 -04:00
Matt Broadstone 75ebbec309 stubbed out an SslClient, no tests at all but it builds 2014-06-05 21:31:24 -04:00
Matt Broadstone 607af62b7a added crude autotest for autoReconnect, made connect and disconnect private slots of Client 2014-06-05 16:09:52 -04:00
Matt Broadstone d9d52e489a Queue::messageReceived no longer passes the queue as a parameter (use sender() if you need it)
fixed qamqp manual test to send key before message
2014-06-05 15:44:14 -04:00
Matt Broadstone 01d792f38d refactor Message to be explicitly shared class, rather than passing
shared pointers around directly
2014-06-05 15:37:41 -04:00
Matt Broadstone 73a1d1db36 organize which methods are related to which parts of the spec, try to figure
out what we're missing
2014-06-05 14:10:29 -04:00
Matt Broadstone 6f05bf5ef9 remove convenience bind methods from exchange, reducing the confusion about
how queues are actually bound to an exchange (not the other way around)
2014-06-04 23:44:07 -04:00
Matt Broadstone eaee35df12 add a test for a default exchange to tst_QAMQPQueue 2014-06-04 10:24:45 -04:00
Matt Broadstone 1a769b2b48 rename ChannelPrivate::number -> channelNumber 2014-06-04 09:50:31 -04:00
Matt Broadstone 343609d884 move all frame handlers to private classes in an effort to make amqp_frame private 2014-06-04 09:46:15 -04:00
Matt Broadstone 80ba14136b rename customProperty -> customProperties 2014-06-03 17:30:41 -04:00
Matt Broadstone 983eb60f76 fix delayed declarations for different exchange types 2014-06-03 16:33:43 -04:00
Matt Broadstone d4b1824b46 merged Client Connection and Network classes, fixed a bug allowing for proper
connecting and disconnecting from a broker
2014-06-03 16:11:30 -04:00
Matt Broadstone fde4bcf39a overhauled tests, added TestCase class, made a few skeleton auto tests 2014-06-03 13:48:50 -04:00
Matt Broadstone 1198db2857 refactored Channel, changed some methods to better convey their intention 2014-06-03 13:00:25 -04:00
Matt Broadstone 128f350cf8 refactored QAMQP::Network to include a dptr, made whole class private as it is
not meant to be used externally (only used by Client internally)
2014-06-03 12:28:12 -04:00
Matt Broadstone 60bcfabe2b refactor Connection into a private class, since it can only be created by a Client.
moved ConnectionPrivate methods into Connection
2014-06-03 11:50:24 -04:00
Matt Broadstone 9eabe0587e refactored Connection to take a Network in the ctor
standardized variable names
decoupled Connection and Client (they are no longer friends)
2014-06-03 09:13:37 -04:00
Matt Broadstone 360e64b34b add auto tests for standard exchange types
fixed a bug with reporting the removal of an exchange
added an ExchangeType enum for standard types
2014-06-02 11:00:04 -04:00
Matt Broadstone 4aa8397f2a style fixes 2014-05-30 17:20:11 -04:00
Matt Broadstone 477cca3d69 moved publish from private to main class 2014-05-30 17:07:41 -04:00
Matt Broadstone 5bd2ebbde8 moved declare/remove from private to main class 2014-05-30 16:56:29 -04:00
Matt Broadstone 10ca783442 split binded to bound/unbound, replaced invokeMetaMethod with Q_EMIT 2014-05-30 15:40:38 -04:00
Matt Broadstone 93287a4836 moved declare/remove from QueuePrivate to Queue 2014-05-30 15:36:11 -04:00
Matt Broadstone d8da64b373 merge QueuePrivate and Queue bind/unbind methods 2014-05-30 15:20:57 -04:00
Matt Broadstone 598b10bf73 merge more code from private functions to Queue class 2014-05-30 15:10:55 -04:00
Matt Broadstone 1c3bd9fdf1 merge _q_body/_q_content from QueuePrivate to Queue 2014-05-30 14:57:09 -04:00
Matt Broadstone e5e3036d03 merge Queue::purge and QueuePrivate::purge 2014-05-30 14:51:44 -04:00
Matt Broadstone c6d0c57d5f remove crufty unused functions, used constBegin/End for iterations, store itEnd during loop, various other cleanups 2014-05-30 14:33:24 -04:00
Matt Broadstone e325037fdd remove needless function duplication in private class 2014-05-29 14:10:38 -04:00
Matt Broadstone 3d69359431 renamed open/close methods to connectToHost/disconnectFromHost (to mirror Qt socket API), added the first auto tests! 2014-05-29 10:16:33 -04:00
Matt Broadstone 8f39b2a367 missed a few namespace cleanups 2014-05-28 16:28:45 -04:00
Matt Broadstone 2ba2823b84 export it all! this may be unnecessary, more investigation needed 2014-05-28 15:33:15 -04:00
Matt Broadstone 64f23fd648 namespace cleanup 2014-05-28 14:58:18 -04:00
Matt Broadstone cd33957147 rename amqp => amqp_client 2014-05-28 13:05:51 -04:00
Matt Broadstone 7394092f60 turn qamqp into a proper library, set up test dir structure, moved qamqp test app to manual test 2014-05-28 12:52:42 -04:00
Matt Broadstone 565d0e04df rename and move pro files 2014-05-28 12:36:50 -04:00
Matt Broadstone dbb03b9df4 move library files to src directory 2014-05-28 12:35:31 -04:00
Matt Broadstone 0dfa78a9db moved qamqp cli code to a manual test 2014-05-28 12:35:05 -04:00
Matt Broadstone c069b063d3 use Q_Q/Q_D from Qt rather than P_Q/P_D, style cleanups for Qt coding style
delete exception-related code, as Qt does not officially support them anymore
2014-05-28 12:26:55 -04:00
Adam Majer 0bad40be56 Allocate internal structures before using them
ClientPrivate::parseCnnString() touches class parameters that are
allocated in the init() function.
2014-04-30 12:48:44 -05:00
Adam Majer 29fc73a5d2 Provide a valid default port when parsing QUrl
When port is not specified in QUrl, the default value is
returned. This default value is -1, which was promptly cast to an
unsigned integer.
2014-04-30 12:46:26 -05:00
Alexey Shcherbakov 5c4db2233c Merge branch 'master' of https://github.com/fuCtor/QAMQP 2013-09-08 11:16:10 +06:00
Alexey Shcherbakov ea61479ced fix #28 2013-09-08 11:15:47 +06:00
Alexey Shcherbakov 1a05e873cb fix headers deserialize 2013-04-28 11:06:23 +06:00
Alexey Shcherbakov d5c3a5d521 fix headers deserialize 2013-04-28 11:05:04 +06:00
Alexey Shcherbakov bbfda4931e Fixes#24. Manually merge with fixes maked by @qnective 2013-04-02 20:30:10 +06:00
Alexey Shcherbakov e3327dbf6d fix ssl 2013-04-01 00:04:57 -07:00
Alexey Shcherbakov 94956ca0a3 remove cyrillic comments 2013-03-31 11:50:58 +06:00
Alexey Shcherbakov 13fa6ec71a Add QT_NO_SSL 2013-03-11 19:24:44 +06:00
Alexey Shcherbakov 21ea86cbb6 fix 2013-02-24 20:00:49 -08:00
Alexey Shcherbakov d13fbcd10c fix 2013-02-24 20:00:12 -08:00
Alexey Shcherbakov 4efe2c4031 remove old example 2013-02-23 13:43:24 +06:00
Alexey Shcherbakov e56a6afa9d Merge pull request #15 from mdhooge/master
The next 3 tutorials
2013-02-22 23:36:07 -08:00
Alexey Shcherbakov 687466ce09 merge with branch qt5 2013-02-23 13:34:58 +06:00
Alexey Shcherbakov 9699491ef1 add heartbeat 2013-02-23 13:20:01 +06:00
Michel D'HOOGE d4edcb7008 The "Routing" Tutorial 2013-02-20 17:58:51 +01:00
Michel D'HOOGE 1d9e43357b The "Publish/Subscribe" Tutorial 2013-02-20 17:06:23 +01:00
Michel D'HOOGE 2e4530c382 The "Work Queues" example 2013-02-20 16:26:10 +01:00
Michel D'HOOGE fce4a083fa Merge branch 'typo' 2013-02-19 22:43:56 +01:00
Michel D'HOOGE 0aa1d8d36b The "Hello World!" tutorial 2013-02-19 18:56:16 +01:00
Michel D'HOOGE 6b5ed036ad Typo: deley -> delay 2013-02-19 11:51:42 +01:00
Michel D'HOOGE 4d02fe7383 Virtual destructor for QAMQP::Frame::Base
To solve the GCC warning:
deleting object of polymorphic class type ‘QAMQP::Frame::Method’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
2013-02-19 11:29:00 +01:00
Michel D'HOOGE e2c77e13d8 Typo: messageRecieved -> messageReceived 2013-02-19 10:56:05 +01:00
Alexey Shcherbakov f15e2314d6 fix for Qt5 2013-02-17 15:06:48 +06:00
Alexey Shcherbakov 6f91b3b2b9 fix exchange 2013-02-08 19:43:51 +06:00
Alexey Shcherbakov 255b6a3921 fix channel open 2013-02-01 15:17:58 +06:00
Alexey Shcherbakov 040671e452 fix delayed open
Fix delayed creation exchange and queue.
2013-02-01 15:07:09 +06:00
Alexey Shcherbakov b2dbd2a85c correct byte-order for integer read 2012-09-30 16:12:20 +06:00
Matwey V. Kornilov b0abf3d2c1 fixed comparison that was always true due to limited range of data type 2012-09-29 22:00:59 +04:00
Matwey V. Kornilov b1549e83cf fixed gcc warnings: initializing order
or your changes. Lines starting
2012-09-29 21:51:24 +04:00
Matwey V. Kornilov c6da70daba fixed gcc warnings 'unused variable' 2012-09-29 21:45:55 +04:00
Matwey V. Kornilov 7082363b4b fixed gcc warnings 'enumeration value not handled' 2012-09-29 21:40:07 +04:00
Matwey V. Kornilov 6139a271e0 added missed stdio.h for fprintf 2012-09-29 21:25:17 +04:00
fuCtor 0a7dc59c27 [*] add example with persistent delivery mode 2012-07-25 06:21:26 -07:00
fuCtor a03c19cc8f [+] property for sending message 2012-07-25 06:18:56 -07:00
fuCtor 773dd72ddd [+] Start write documentation 2012-07-18 09:18:04 -07:00
fuCtor 3a41a3857f [*] fix under Linux 2012-05-30 21:12:30 -07:00
fuCtor f2f34c1d40 [*] fix reconnect 2012-05-30 02:09:03 -07:00
fuCtor 1f2aaec772 [+] custom client properties 2012-05-28 03:01:49 -07:00
fuCtor 8fb83ba1a4 [*] fix reconnection 2012-05-24 20:34:16 -07:00
fuCtor 8cd2702641 Change version 2012-05-24 02:54:09 -07:00
fuCtor fd64ee6a59 + headers for Exchange::publish method
+ redeclare Exchange after reconnection

* fixed Frame::Content (de)serialize
2012-05-24 01:50:36 -07:00
fuCtor 71607a7635 2012-05-23 21:45:23 -07:00
fuCtor a01c8d0ceb 2012-05-23 21:43:48 -07:00
fuCtor 571edd3eab 2012-05-23 20:53:32 -07:00
fuCtor e12f436cbe + auto reconnection
+ SSL support
2012-05-23 03:49:56 -07:00
fuCtor 8a4c5dbc57 2012-05-23 03:23:20 -07:00
fuCtor cc114ac9c2 [*] remove dependency from QObjectPrivate 2012-04-17 06:51:48 -07:00
fuCtor 288c9df70a [*] remove dependency from QObjectPrivate 2012-04-17 06:50:44 -07:00
fuCtor 82f2d89435 2012-02-26 02:02:44 -08:00
fuCtor 551f9a13a5 2012-02-26 01:21:57 -08:00
fuCtor 267c9801f0 [+] Authenticator - authentication mechanism abstraction
[+] AMQPLAIN authentication Authenticator implement
2012-02-23 05:54:04 -08:00
fuCtor 9874e0af26 [+] Отправка/получение сообщений произвольного размера. 2012-02-19 00:55:29 -08:00
fuCtor 19a0496712 2012-02-18 23:19:16 -08:00
fuCtor c3150322c1 2012-02-18 03:40:24 -08:00
fuCtor 3fbb01fef4 [+] Exchange
[+] Queue
[+] Basic.publish
2012-02-12 04:22:10 -08:00