Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better examples #15

Closed
s-celles opened this issue Nov 22, 2018 · 3 comments
Closed

Provide better examples #15

s-celles opened this issue Nov 22, 2018 · 3 comments

Comments

@s-celles
Copy link
Contributor

s-celles commented Nov 22, 2018

Hello,

It will be nice if we could find examples comparables to
https://www.rabbitmq.com/tutorials/tutorial-one-python.html

  1. Hello World
  2. Work queues
  3. Publish/Subscribe
  4. Routing
  5. Topics
  6. RPC

(code available for several language at https://github.com/rabbitmq/rabbitmq-tutorials )

I'm personally trying to use Python receive.py script (from "Hello World" example) and write a Julia send.jl script ie I'm trying to convert

#!/usr/bin/env python
import pika

connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()


channel.queue_declare(queue='hello')

channel.basic_publish(exchange='',
                      routing_key='hello',
                      body='Hello World!')
print(" [x] Sent 'Hello World!'")
connection.close()

to Julia

I did this:

using AMQPClient

port = AMQPClient.AMQP_DEFAULT_PORT

# login = ""  # "guest"
# password = ""  # "guest"
# auth_params = Dict("MECHANISM"=>"AMQPLAIN", "LOGIN"=>login, "PASSWORD"=>password)
auth_params = Dict("MECHANISM"=>"AMQPLAIN")

conn = connection(;virtualhost="/", host="localhost", port=port, auth_params=auth_params)

chan = channel(conn, AMQPClient.UNUSED_CHANNEL, true)

success, message_count, consumer_count = queue_declare(chan, "hello")

basic_publish(chan, "Hello World!"; exchange=EXCG_DIRECT, routing_key="hello")
println(" [x] Sent 'Hello World!'")

if isopen(conn)
    close(conn)
    # close is an asynchronous operation. To wait for the negotiation to complete:
    AMQPClient.wait_for_state(conn, AMQPClient.CONN_STATE_CLOSED)
end

but Julia script is blocked at:

conn = connection(;virtualhost="/", host="localhost", port=port, auth_params=auth_params)

Any idea what is going wrong?

Kind regards

@jasonmarquette
Copy link

One thing to check is if your port that you are using isn’t being blocked by a firewall.

@s-celles
Copy link
Contributor Author

s-celles commented Jan 5, 2019

I don't think it's a firewall issue because a similar Python script works fine.

@s-celles
Copy link
Contributor Author

Examples are now available at https://github.com/rabbitmq/rabbitmq-tutorials/blob/main/julia/README.md thanks to @kracekumar
Maybe it should be mentioned in the documentation of this library.

s-celles pushed a commit to s-celles/AMQPClient.jl that referenced this issue Oct 18, 2022
tanmaykm pushed a commit that referenced this issue Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants