-
Notifications
You must be signed in to change notification settings - Fork 6
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
amqp interop based example #3
Conversation
@carlhoerberg could you please have a look at this? |
$ch->basic_publish($msg, $exchange); | ||
$context = (new AmqpConnectionFactory(getenv('CLOUDAMQP_URL')))->createContext(); | ||
$queue = $context->createQueue('basic_get_queue'); | ||
$queue->addFlag(AmqpQueue::FLAG_DURABLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can you set a flag after the queue is declared? all queue arguments are immutable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carlhoerberg On a broker's side, it is indeed immutable, though if we try to declare a queue with exactly the same parameters several times the broker won't complain.
The createQueue
method does not perform declaration. It creates a local queue object. There is a declareQueue
method that does the job.
The queue interop is insipred by Java JMS spec and follows it. Here's the doc for create queue method: https://docs.oracle.com/javaee/7/api/javax/jms/JMSContext.html#createQueue-java.lang.String-
$ch->close(); | ||
$conn->close(); | ||
?> | ||
$context->createProducer()->send($queue, $message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's a producer? a channel? so you create a single channel for each publish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's a producer?
https://docs.oracle.com/javaee/7/api/javax/jms/JMSProducer.html
The most important parts from there:
A JMSProducer is a simple object used to send messages on behalf of a JMSContext.
Instances of JMSProducer are intended to be lightweight objects which can be created freely and which do not consume significant resources. This interface therefore does not provide a close method.
a channel?
The producer is not a channel. The context is a representation of AMQP's channel.
https://docs.oracle.com/javaee/7/api/javax/jms/JMSContext.html
@carlhoerberg Is there any interest in this? Or should I close it? |
@snichme could you please take a look at it |
I propose to rewrote examples using amqp interop. It has several benefits:
We ported RabbitMQ official tutorials to amqp interop too.