How to check is some bind present or no?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to check is some bind present or no?

Haster
Hi there!
I look at all amqp methods and don't find any one that can give me information about is some binding present or not.

For example, I want make binding only if it isn't present (I want delete all bindings that I created when my program stopped, but I don't want delete bind if they were present before).

Is it any method to do it?
Reply | Threaded
Open this post in threaded view
|

Re: How to check is some bind present or no?

Michael Klishin
On sep 26, 2013, at 3:49 p.m., Haster <[hidden email]> wrote:

> I look at all amqp methods and don't find any one that can give me
> information about is some binding present or not.

HTTP API can list bindings.

MK




_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

signature.asc (506 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to check is some bind present or no?

Haster
 Michael, thanks for reply!
I'll try
Reply | Threaded
Open this post in threaded view
|

Re: How to check is some bind present or no?

Matthias Radestock-3
In reply to this post by Haster
On 26/09/13 13:49, Haster wrote:
> Hi there!
> I look at all amqp methods and don't find any one that can give me
> information about is some binding present or not.
>
> For example, I want make binding only if it isn't present (I want delete all
> bindings that I created when my program stopped, but I don't want delete
> bind if they were present before).

So, just to be clear, you want to write a program that does the following:

1) for all bindings that need to be created, check whether the binding
already exists

2) if the binding does not exist then create it and remember that

3) when the program finishes, delete all the bindings that were created
in step (2)

The above would be fantastically racy. What if some other program added
or deleted a binding between step 1 and 2?

An alternative, non-racy approach would be to make the bindings unique
to the program by adding some a program invocation specific GUID to the
binding arguments.

Matthias.
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How to check is some bind present or no?

Haster
 Matthias, yes you has understood my use case correct!

And thanks a lot for your comment, I didn't think about race problems.
Use bind arguments, i think, is a good idea