JuliaComputing / AMQPClient.jl

A Julia AMQP (Advanced Message Queuing Protocol) / RabbitMQ Client.
Other
39 stars 21 forks source link

Docstring improvements #45

Open mmiller-max opened 3 years ago

mmiller-max commented 3 years ago

Hi there, I've been enjoying using this package and am keen to help improve docstrings. My motivation for this is I've been having to check the source code to find kwargs/default values of kwargs. A lot of this may be fine for someone who is more familiar with AMQP and that may be why there is not a lot of detail in it, but do you think the below change to the queue_declare is useful? If so I can update a few more (e.g. for the functions that are mentioned in the various markdown docs).

    queue_declare(chan::MessageChannel,
                  name::String;
                  passive::Bool=false,
                  durable::Bool=false,
                  exclusive::Bool=false,
                  auto_delete::Bool=false,
                  nowait::Bool=false,
                  timeout::Int=DEFAULT_TIMEOUT,
                  arguments::Dict{String,Any}=Dict{String,Any}())

Declare a queue (or query an existing queue).

To let the broke decide on the queue name, set `name` to `""`.

Returns a tuple: (boolean success/failure, queue name, message count, consumer count)

# Optional Arguments
- `passive::Bool=false`: if `true`, the server will reply with Declare-Ok if the queue already exists with the same name, and raise an error if not. 
- `durable::Bool=false`: if `true` the queue will survive a broker restart.
- `exclusive::Bool=false`: if `true` the queue will only be used by only one connection and the queue will be deleted when that connection closes.
- `auto_delete::Bool=false`: if `true` when the queue has had at least one consumer it is deleted when last consumer unsubscribes.
- `nowait::Bool=false`: if `true` the server will not respond. Errors will be raised via connection or channel exception.
- `timeout::Int=DEFAULT_TIMEOUT`:
- `arguments::Dict{String,Any}=Dict{String,Any}()`:  used by plugins and broker-specific features such as message TTL, queue length limit, etc.

Let me know, I'm happy to go through and add more docstrings if it'll be useful.

tanmaykm commented 3 years ago

Sorry, noticed this perhaps a bit late. Sure, it will definitely be useful. Please feel free to put up a PR with more docstrings!