Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coolamqp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
coolamqp
Commits
ac041424
Commit
ac041424
authored
7 months ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
docs fix
parent
ab83ea0a
No related branches found
No related tags found
No related merge requests found
Pipeline
#63908
passed with stages
in 2 minutes and 25 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/advanced.rst
+0
-17
0 additions, 17 deletions
docs/advanced.rst
docs/how-to-guide.rst
+19
-18
19 additions, 18 deletions
docs/how-to-guide.rst
docs/index.rst
+0
-1
0 additions, 1 deletion
docs/index.rst
with
19 additions
and
36 deletions
docs/advanced.rst
deleted
100644 → 0
+
0
−
17
View file @
ab83ea0a
Advanced things
===============
.. autoclass:: coolamqp.uplink.connection.Connection
:members:
Declaring anonymous queues
--------------------------
.. _anonymq:
In order to make use of an anonymous queue, you must first :meth:`coolamqp.clustering.Cluster.consume` it, since
:meth:`coolamqp.clustering.Cluster.declare` will use a separate channel, in which the queue will be invalid. It will
raise ValueError if you try to do that, anyway.
Anonymous queues must be auto_delete and exclusive, ValueError will be raised otherwise.
This diff is collapsed.
Click to expand it.
docs/how-to-guide.rst
+
19
−
18
View file @
ac041424
How to guide
============
Connecting to a broker
----------------------
If you want to connect to an AMQP broker, you need:
* its address (and port)
* login and password
...
...
@@ -26,7 +29,7 @@ accepts a list of nodes:
.. code-block:: python
from coolamqp.clustering import Cluster
cluster = Cluster(
[
node
]
, name='My Cluster')
cluster = Cluster(node, name='My Cluster')
cluster.start(wait=True)
*wait=True* will block until connection is completed. After this, you can use other methods.
...
...
@@ -36,10 +39,6 @@ receive a provided label, postfixed by **AMQP listener thread**.
.. _setproctitle: https://pypi.org/project/setproctitle/
.. autoclass:: coolamqp.clustering.Cluster
:members:
Publishing and consuming
------------------------
...
...
@@ -58,14 +57,8 @@ you must first define a queue, and register a consumer.
This will create an auto-delete and exclusive queue. After than, a consumer will be registered for this queue.
_no_ack=False_ will mean that we have to manually confirm messages.
.. warning:: if you declare a :class:`coolamqp.objects.Queue` without a name, this client will automatically
generate an UUID-name for you, and verify the queue is auto_delete. Since RabbitMQ supports
`automatic queue name generation <https://www.rabbitmq.com/docs/queues#names>`_,
this client does not use it, because the queue is valid only for the channel that declared it,
and CoolAMQP declares things with a dedicated channel.
You can specify a callback, that will be called with a message if one's received by this consumer. Since
we did not do that, this will go to a generic queue belonging to _Cluster_.
You should specify a callback. It will be executed in receiving thread's context, so it can't block for long.
If you're looking for receiving messages yourself, familiarize yourself with :meth:`coolamqp.clustering.Cluster.drain`.
_consumer_ is a _Consumer_ object. This allows us to do some things with the consumer (such as setting QoS),
but most importantly it allows us to cancel it later. _consume_confirm_ is a _Future_, that will succeed
...
...
@@ -75,13 +68,12 @@ To send a message we need to construct it first, and later publish:
.. code-block:: python
from coolamqp.objects import Message
from coolamqp.objects import Message
, MessageProperties
msg = Message(b'hello world', properties=Message
.
Properties())
msg = Message(b'hello world', properties=MessageProperties())
cluster.publish(msg, routing_key=u'my_queue')
.. autoclass:: coolamqp.objects.Message
:members:
The default exchange is the direct exchange, which will target the queue whose name is equal to routing_key.
This creates a message with no properties, and sends it through default (direct) exchange to our queue.
Note that CoolAMQP simply considers your messages to be bags of bytes + properties. It will not modify them,
...
...
@@ -95,9 +87,18 @@ To actually get our message, we need to start a consumer first. To do that, just
Where kwargs are passed directly to Consumer class.
**cons** is a Consumer object, and **fut** is a Future that will happen when listening has been registered on target
server.
server.
However, not providing a
.. autoclass:: coolamqp.attaches.Consumer
:members:
Declaring anonymous queue
-------------------------
.. _anonymq:
In order to make use of an anonymous queue, you must first :meth:`coolamqp.clustering.Cluster.consume` it, since
:meth:`coolamqp.clustering.Cluster.declare` will use a separate channel, in which the queue will be invalid. It will
raise ValueError if you try to do that, anyway.
Anonymous queues must be auto_delete and exclusive, ValueError will be raised otherwise.
This diff is collapsed.
Click to expand it.
docs/index.rst
+
0
−
1
View file @
ac041424
...
...
@@ -11,7 +11,6 @@ Welcome to CoolAMQP's documentation!
how-to-guide
caveats
tracing
advanced
reference
frames
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment