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

How can i declare an auto_delete exchange #218

Closed
hahaya opened this issue Oct 14, 2014 · 5 comments
Closed

How can i declare an auto_delete exchange #218

hahaya opened this issue Oct 14, 2014 · 5 comments

Comments

@hahaya
Copy link

hahaya commented Oct 14, 2014

In amqp_framing.c has this function:

AMQP_PUBLIC_FUNCTION amqp_exchange_declare_ok_t * AMQP_CALL amqp_exchange_declare(amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t exchange, amqp_bytes_t type, amqp_boolean_t passive, amqp_boolean_t durable, amqp_table_t arguments)
{
  amqp_exchange_declare_t req;
  req.ticket = 0;
  req.exchange = exchange;
  req.type = type;
  req.passive = passive;
  req.durable = durable;
  req.auto_delete = 0;
  req.internal = 0;
  req.nowait = 0;
  req.arguments = arguments;

  return amqp_simple_rpc_decoded(state, channel, AMQP_EXCHANGE_DECLARE_METHOD, AMQP_EXCHANGE_DECLARE_OK_METHOD, &req);
}

In this function req.auto_delete = 0;

How can I declare an auto_delete exchange? Thanks.

@alanxz
Copy link
Owner

alanxz commented Oct 15, 2014

It looks like those parameters were disabled in codegen.py for reasons unknown to me (before I took maintainership of the project, likely it wasn't enabled on the broker side). I'll consider making this a part of the function signature.

The workaround is to do what that function does in your own code and set the auto_delete parameter to something other than 1 to enable it.

@hahaya
Copy link
Author

hahaya commented Oct 15, 2014

Thank you very much, I will set auto_delete = 1 to enable it .
.

@hahaya hahaya closed this as completed Oct 15, 2014
alanxz added a commit that referenced this issue Oct 19, 2014
Enable auto_delete and internal parameters of amqp_exchange_declare() in
codegen. These were once not generated because RabbitMQ did not support these
parameters. The broker now supports these and so should we.

This fixes #218
@pinepain
Copy link

Commit 9626dd5 breaks BC. Actually, fixing errors is good, but it would be nice to note about BC breakage in next release notes.

Thanks for a great work!

@alanxz
Copy link
Owner

alanxz commented Oct 23, 2014

I am aware that this is an API and an ABI break. I do add these sorts of changes to the change log when I create a release.

That said, if your build process relies on building from HEAD, you're going to run into issues like this from time to time. Your best bet is to build from a tagged release.

@pinepain
Copy link

Yeah, building from releases is the best option. I do so, but one of php-amqp user found that issue so I just curious whether BC is broken by-design or it just bug.

For php-amqp it would not be a problem to check framing version and make a tiny wrapped in macro to deal with such kind of changes.

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

3 participants