# Facing problem in redeclaring rabbit\_mq exchange name

**URL:** <https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755>\
**Category:** Elasticsearch\
**Created:** [February 15, 2013, 3:01pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755 "2013-02-15T15:01:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![C\_K\_R\_VIJAY\_Krishna](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@C\_K\_R\_VIJAY\_Krishna](https://discuss.elastic.co/u/C_K_R_VIJAY_Krishna)\
**Post date:** [February 15, 2013, 3:01pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/1 "2013-02-15T15:01:38Z")

</div>

Hi,  
I am new to elastic search. Please find below sample json format which  
is used to create index in elastic search by using rabbitmq-river plugin.  
In this code "vijay\_exg" exchange is already exists in rabbitmq server.I  
want to retrieve the messages from this exchange.When I am trying to  
execute the below code it is generating error in elastic search log file

Sample Code :

curl -XPUT 'localhost:9200/\_river/my\_river/\_meta' -d '{

"type" : "rabbitmq",  
"rabbitmq" : {  
"host" : "localhost",  
"port" : 5672,  
"user" : "guest",  
"pass" : "guest",  
"vhost" : "/",  
"queue" : "vijay\_test",  
"exchange" : "vijay\_exg",  
"routing\_key" : "routing\_key",  
"exchange\_type" : "topic",  
"exchange\_durable" : true,  
"queue\_durable" : true,  
"queue\_auto\_delete" : false,  
"args" : {  
"x-ha-policy" : "all"  
}  
},  
"index" : {  
"bulk\_size" : 100,  
"bulk\_timeout" : "10ms",  
"ordered" : false  
}  
}'

Error Message:

{amqp\_error,precondition\_failed,

```
        "cannot redeclare exchange 'vijay_exg' in vhost '/' with 

```

different type, durable, internal or autodelete value",

```
        'exchange.declare'}

```

Please help me.

Thanks & Regards,  
Vijay

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [February 15, 2013, 5:23pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/2 "2013-02-15T17:23:24Z")

</div>

C.K.R.VIJAY Krishna wrote:

[...]

> ```
> "exchange" : "vijay_exg",
> "routing_key" : "routing_key",
> "exchange_type" : "topic",
> "exchange_durable" : true,
> "queue_durable" : true,
> "queue_auto_delete" : false,
> 
> ```

[...]

> Error Message:
> 
> {amqp\_error,precondition\_failed,
> 
> ```
> "cannot redeclare exchange 'vijay_exg' in vhost '/' with 
> 
> ```
> 
> different type, durable, internal or autodelete value",
> 
> ```
> 'exchange.declare'}
> 
> ```

This means that you created the vijay\_exg exchange previously using  
parameters that don't match the ones in the river settings. You  
probably didn't create it with durable=true, if I had to guess.

Rabbit wants each of those things to match up for exchanges and  
queues.

-Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![C\_K\_R\_VIJAY\_Krishna](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@C\_K\_R\_VIJAY\_Krishna](https://discuss.elastic.co/u/C_K_R_VIJAY_Krishna)\
**Post date:** [February 18, 2013, 10:08am UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/3 "2013-02-18T10:08:16Z")

</div>

Hi Drew,  
Thanks for your reply. Now I have created new exchange "vijay\_exh1"  
as durable in rabbit MQ Server and made rabbit\_mq queue as durable.  
In the above sample code I made "exchange\_durable" :true "queue\_durable" :  
true, and started publishing messages in exchange "vijay\_exh1" but I can't  
able to consume messages in Elasticsearch and there is no error in elastic  
search log file.Please help me.

sample code :

curl -XPUT '[http://localhost:9200/\_river/my\_cdr/\_meta](http://localhost:9200/_river/my_cdr/_meta)' -d '{  
"type" : "rabbitmq",  
"rabbitmq" : {  
"host" : "localhost",  
"port" : 5672,  
"user" : "guest",  
"pass" : "guest",  
"vhost" : "/",  
"queue" : "vijay\_test",  
"exchange" : "vijay\_exh1",  
"routing\_key" : "call.cdr.\*",  
"exchange\_type" : "topic",  
"exchange\_durable" :true,  
"queue\_durable" : true,  
"queue\_auto\_delete" : false,  
"args" : {  
"x-ha-policy" : "all"  
}  
},  
"index" : {  
"bulk\_size" : 100,  
"bulk\_timeout" : "10ms",  
"ordered" : false  
}  
}'

Thanks & Regards,  
Vijay.

On Friday, February 15, 2013 10:01:38 AM UTC-5, C.K.R.VIJAY Krishna wrote:

> Hi,  
> I am new to Elasticsearch. Please find below sample json format which  
> is used to create index in Elasticsearch by using rabbitmq-river plugin.  
> In this code "vijay\_exg" exchange is already exists in rabbitmq server.I  
> want to retrieve the messages from this exchange.When I am trying to  
> execute the below code it is generating error in Elasticsearch log file
> 
> Sample Code :
> 
> curl -XPUT 'localhost:9200/\_river/my\_river/\_meta' -d '{
> 
> "type" : "rabbitmq",  
> "rabbitmq" : {  
> "host" : "localhost",  
> "port" : 5672,  
> "user" : "guest",  
> "pass" : "guest",  
> "vhost" : "/",  
> "queue" : "vijay\_test",  
> "exchange" : "vijay\_exg",  
> "routing\_key" : "routing\_key",  
> "exchange\_type" : "topic",  
> "exchange\_durable" : true,  
> "queue\_durable" : true,  
> "queue\_auto\_delete" : false,  
> "args" : {  
> "x-ha-policy" : "all"  
> }  
> },  
> "index" : {  
> "bulk\_size" : 100,  
> "bulk\_timeout" : "10ms",  
> "ordered" : false  
> }  
> }'
> 
> Error Message:
> 
> {amqp\_error,precondition\_failed,
> 
> ```
> "cannot redeclare exchange 'vijay_exg' in vhost '/' with 
> 
> ```
> 
> different type, durable, internal or autodelete value",
> 
> ```
> 'exchange.declare'}
> 
> ```
> 
> Please help me.
> 
> Thanks & Regards,  
> Vijay

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [February 18, 2013, 2:56pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/4 "2013-02-18T14:56:13Z")

</div>

C.K.R.VIJAY Krishna wrote:

> Thanks for your reply. Now I have created new exchange "vijay\_exh1"  
> as durable in rabbit MQ Server and made rabbit\_mq queue as durable.  
> In the above sample code I made "exchange\_durable" :true  
> "queue\_durable" : true, and started publishing messages in exchange  
> "vijay\_exh1" but I can't able to consume messages in Elasticsearch  
> and there is no error in Elasticsearch log file.Please help me.

If you're not getting errors in rabbit log or ES log, then it's  
likely you're publishing messages that aren't routing properly within  
rabbit.

Use the rabbit web interface or calls to:

rabbitmqctl list\_queues -p / messages messages\_unacknowledged name

to see if the vijay\_test queue is accumulating messages. If it  
isn't, and no other queue is catching them, then they're probably  
getting dropped by the exchange.

-Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![C\_K\_R\_VIJAY\_Krishna](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@C\_K\_R\_VIJAY\_Krishna](https://discuss.elastic.co/u/C_K_R_VIJAY_Krishna)\
**Post date:** [February 19, 2013, 11:47am UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/5 "2013-02-19T11:47:54Z")

</div>

Hi,  
Thanks for your reply Drew. I have restarted the Elasticsearch server and  
noticed following error message in Elasticsearch log file and in rabbitmq  
queue i have noticed 8 unacknowledged messages.

[WARN][river.rabbitmq] [elasticserver] [rabbitmq][my\_cdr] failed to  
execute bulk for delivery tags [[8]], not ack'ing  
org.elasticsearch.action.ActionRequestValidationException: Validation  
Failed: 1: no requests added;  
at  
org.elasticsearch.action.ValidateActions.addValidationError(ValidateActions.java:29)  
at  
org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:375)  
at  
org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:55)  
at  
org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:92)  
at  
org.elasticsearch.client.support.AbstractClient.bulk(AbstractClient.java:145)  
at  
org.elasticsearch.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:129)  
at  
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:62)  
at  
org.elasticsearch.river.rabbitmq.RabbitmqRiver$Consumer.run(RabbitmqRiver.java:291)  
at java.lang.Thread.run(Thread.java:722).

Thanks & Regards,  
Vijay

On Monday, February 18, 2013 9:56:13 AM UTC-5, Drew Raines wrote:

> C.K.R.VIJAY Krishna wrote:
> 
> > Thanks for your reply. Now I have created new exchange "vijay\_exh1"  
> > as durable in rabbit MQ Server and made rabbit\_mq queue as durable.  
> > In the above sample code I made "exchange\_durable" :true  
> > "queue\_durable" : true, and started publishing messages in exchange  
> > "vijay\_exh1" but I can't able to consume messages in Elasticsearch  
> > and there is no error in Elasticsearch log file.Please help me.
> 
> If you're not getting errors in rabbit log or ES log, then it's  
> likely you're publishing messages that aren't routing properly within  
> rabbit.
> 
> Use the rabbit web interface or calls to:
> 
> rabbitmqctl list\_queues -p / messages messages\_unacknowledged name
> 
> to see if the vijay\_test queue is accumulating messages. If it  
> isn't, and no other queue is catching them, then they're probably  
> getting dropped by the exchange.
> 
> -Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [February 19, 2013, 7:49pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/6 "2013-02-19T19:49:42Z")

</div>

C.K.R.VIJAY Krishna wrote:

> Thanks for your reply Drew. I have restarted the Elasticsearch  
> server and noticed following error message in Elasticsearch log  
> file and in rabbitmq queue i have noticed 8 unacknowledged  
> messages.
> 
> [WARN][river.rabbitmq] [elasticserver] [rabbitmq][my\_cdr] failed to  
> execute bulk for delivery tags [[8]], not ack'ing  
> org.elasticsearch.action.ActionRequestValidationException: Validation  
> Failed: 1: no requests added;

OK, this means the payload in your rabbit messages is not valid bulk  
format. Can you gist the exact payload of one of those messages? If  
it's sensitive data, perhaps the code you use to generate them?

-Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![C\_K\_R\_VIJAY\_Krishna](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@C\_K\_R\_VIJAY\_Krishna](https://discuss.elastic.co/u/C_K_R_VIJAY_Krishna)\
**Post date:** [February 20, 2013, 12:41pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/7 "2013-02-20T12:41:13Z")

</div>

Hi Drew,  
Please find below sample payload code which I am getting.  
Sample code.  
{  
"Digits-Dialed": "none",  
"Ringing-Seconds": "2",  
"Billing-Seconds": "4",  
"Duration-Seconds": "7",  
"From-Uri": "vijay\_test\_zoiper@dev.local",  
"To-Uri": "1@2.dev.local",  
"Call-Direction": "inbound",  
"Timestamp": "12345",  
"Callee-ID-Number": "+134567",  
"Callee-ID-Name": "Vijaya",  
"Caller-ID-Number": "vijay\_test\_zoiper",  
"Caller-ID-Name": "Vijaya Krishna",  
"Local-SDP": "v=0\no=FreeSWITCH IN IP4 11.21.122.17\ns=FreeSWITCH\nc=IN  
IP4 \nt=0 0\n",  
"Remote-SDP": "v=0\r\no=Zoiper\_user 0 1 IN IP4  
11.11.12.6\r\ns=Zoiper\_session\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\n",  
"Custom-Channel-Vars": {  
"Authorizing-Type": "device",  
"Account-ID": "accid",  
"Username": "vijay\_test\_zoiper",  
}  
}

Can you please provide one sample payload code . I have tied to publish  
message based on below url but no use.

[https://github.com/elasticsearch/elasticsearch-river-rabbitmq/issues/7](https://github.com/elasticsearch/elasticsearch-river-rabbitmq/issues/7)

Publishing messages to rabbitmq using restclient(firebug plugin) .Please  
help me.

Thanks & Regards,  
Vijay.

On Tuesday, February 19, 2013 2:49:42 PM UTC-5, Drew Raines wrote:

> C.K.R.VIJAY Krishna wrote:
> 
> > Thanks for your reply Drew. I have restarted the Elasticsearch  
> > server and noticed following error message in Elasticsearch log  
> > file and in rabbitmq queue i have noticed 8 unacknowledged  
> > messages.
> > 
> > [WARN][river.rabbitmq] [elasticserver] [rabbitmq][my\_cdr] failed to  
> > execute bulk for delivery tags [[8]], not ack'ing  
> > org.elasticsearch.action.ActionRequestValidationException: Validation  
> > Failed: 1: no requests added;
> 
> OK, this means the payload in your rabbit messages is not valid bulk  
> format. Can you gist the exact payload of one of those messages? If  
> it's sensitive data, perhaps the code you use to generate them?
> 
> -Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [February 20, 2013, 4:14pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/8 "2013-02-20T16:14:29Z")

</div>

C.K.R.VIJAY Krishna wrote:

> Please find below sample payload code which I am getting.  
> Sample code.  
> {  
> "Digits-Dialed": "none",  
> "Ringing-Seconds": "2",  
> "Billing-Seconds": "4",  
> "Duration-Seconds": "7",

[...]

> Can you please provide one sample payload code . I have tied to  
> publish message based on below url but no use.

The payload needs to be a proper bulk request similar to what you'd  
send using curl. Have a look at the bulk api docs for the specifics.  
I'll provide a short example below.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

> [https://github.com/elasticsearch/elasticsearch-river-rabbitmq/issues/7](https://github.com/elasticsearch/elasticsearch-river-rabbitmq/issues/7)

This issue highlights a common issue people have with bulk: newlines  
are significant! If you have them in your json document, they need  
to be properly escaped (which should happen automatically when you  
encode using your favorite library). For example, take this json  
object:

{"foo": "bar\nbaz"}

When encoded to a string, it should look like:

"{"foo":"bar\nbaz"}"

And then to send it with bulk, add meta and the proper newline  
separation. The literal string you would put in your rabbit msg  
would look something like this:

"{"index":{"\_index":"test","\_type":"t"}}\n{"foo":"foo\nbar"}\n"

You can repeat that for as many docs as you want in your request.

Don't forget the trailing newline!

-Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![C\_K\_R\_VIJAY\_Krishna](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@C\_K\_R\_VIJAY\_Krishna](https://discuss.elastic.co/u/C_K_R_VIJAY_Krishna)\
**Post date:** [February 21, 2013, 1:05pm UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/9 "2013-02-21T13:05:37Z")

</div>

Hi Drew,  
Thank you drew. I can able to post a message to rabbit Mq queue and  
Index the message using rabbitmq river plugin .

Thanks & Regards,  
Vijay.

On Friday, February 15, 2013 10:01:38 AM UTC-5, C.K.R.VIJAY Krishna wrote:

> Hi,  
> I am new to Elasticsearch. Please find below sample json format which  
> is used to create index in Elasticsearch by using rabbitmq-river plugin.  
> In this code "vijay\_exg" exchange is already exists in rabbitmq server.I  
> want to retrieve the messages from this exchange.When I am trying to  
> execute the below code it is generating error in Elasticsearch log file
> 
> Sample Code :
> 
> curl -XPUT 'localhost:9200/\_river/my\_river/\_meta' -d '{
> 
> "type" : "rabbitmq",  
> "rabbitmq" : {  
> "host" : "localhost",  
> "port" : 5672,  
> "user" : "guest",  
> "pass" : "guest",  
> "vhost" : "/",  
> "queue" : "vijay\_test",  
> "exchange" : "vijay\_exg",  
> "routing\_key" : "routing\_key",  
> "exchange\_type" : "topic",  
> "exchange\_durable" : true,  
> "queue\_durable" : true,  
> "queue\_auto\_delete" : false,  
> "args" : {  
> "x-ha-policy" : "all"  
> }  
> },  
> "index" : {  
> "bulk\_size" : 100,  
> "bulk\_timeout" : "10ms",  
> "ordered" : false  
> }  
> }'
> 
> Error Message:
> 
> {amqp\_error,precondition\_failed,
> 
> ```
> "cannot redeclare exchange 'vijay_exg' in vhost '/' with 
> 
> ```
> 
> different type, durable, internal or autodelete value",
> 
> ```
> 'exchange.declare'}
> 
> ```
> 
> Please help me.
> 
> Thanks & Regards,  
> Vijay

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:50am UTC](https://discuss.elastic.co/t/facing-problem-in-redeclaring-rabbit-mq-exchange-name/10755/10 "2017-07-06T02:50:21Z")

</div>


