[rabbitmq-discuss] Subscribing an Exchange with RabbitHub
Lijo Sebastian
lijo at citrusinformatics.com
Wed Nov 13 11:46:13 GMT 2013
See the Info report and Crash report below:
=INFO REPORT==== 13-Nov-2013::16:34:26 ===
RabbitHub register subscription (startup); ok
rabbithub_pseudo_queue
{rabbithub_lease,
{rabbithub_subscription,
{resource,<<"/">>,exchange,<<"junk">>},
"foo","http://192.168.1.37:8086/hubsub"},
1384427066480905}
=CRASH REPORT==== 13-Nov-2013::16:34:26 ===
crasher:
initial call: rabbithub_pseudo_queue:init/1
pid: <0.15753.0>
registered_name: []
exception exit: {{badmatch,
{amqqueue,
{resource,<<"/">>,queue,
<<"amq.http.pseudoqueue-Xbp6m5myR_Z21g8Igw-AdA">>},
false,false,none,[],<0.15753.0>,[],undefined,
undefined,undefined,[]}},
[{rabbithub_pseudo_queue,really_init,1,
[{file,"src/rabbithub_pseudo_queue.erl"},{line,28}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
in function gen_server:init_it/6 (gen_server.erl, line 328)
ancestors: [rabbithub_subscription_sup,rabbithub_sup,<0.252.0>]
messages: []
links: [<0.265.0>]
dictionary: [{{xtype_to_module,direct},rabbit_exchange_type_direct},
{guid,{{1572502171,2578597878,1993740040,2198831220},0}}]
trap_exit: true
status: running
heap_size: 987
stack_size: 27
reductions: 624
neighbours:
Any guess?
Regards,
Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
From: Brett Cameron
Sent: Wednesday, November 13, 2013 11:40 AM
To: Lijo Sebastian
Subject: Re: Fwd: [rabbitmq-discuss] Subscribing an Exchange with RabbitHub
The response to the challenge request needs to go back to RabbitHub, which is what you appear to be doing; there should be something in the RabbitMQ log that provides more information as to why this is failing. Possibly your UTF-8 encoding is changing the value, so the sent and received tokens do not match, although an HTTP 500 tends too imply something a bit more serious... possibly the 3.1.5 version of the plugin is not 100% compatible with RabbitMQ 3.2.1... but anything liek this will be evident from the RabbitMQ log.
For my testing I just tend to use the following trivial piece of Ruby Sinatra code, which starts up a web server on port 4567. As you can see, the GET just responds by sending back the challenge token. The POST method just displays the received message and will return an empty response body.
require 'sinatra'
get '/sub2' do
puts "Received #{params}"
puts "Responding to challenge request..."
params[:"hub.challenge"]
end
post '/sub2' do
puts "Received message: #{params} "
end
On Wed, Nov 13, 2013 at 7:00 PM, Lijo Sebastian <lijo at citrusinformatics.com> wrote:
Yeah Brett, i received the token with ‘hub.challenge’ parameter.
But issue here is i think, i need to send response to my server, right?
As now i am trying subscribe part in command prompt with curl commands, and my c# application listening for a callback url, how could i send a response to server from the listening localhost is the issue here i think!
Regards,
Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
From: Brett Cameron
Sent: Wednesday, November 13, 2013 11:19 AM
To: Lijo Sebastian
Subject: Fwd: [rabbitmq-discuss] Subscribing an Exchange with RabbitHub
I probably would have just returned it as a string without doing the UTF-8 encoding, but the the HTTP 500 error is interesting. Check the RabbitMQ log for additional information.
Additionally, can you confirm that your C# code received the token?
---------- Forwarded message ----------
From: Lijo Sebastian <lijo at citrusinformatics.com>
Date: Wed, Nov 13, 2013 at 6:20 PM
Subject: Re: [rabbitmq-discuss] Subscribing an Exchange with RabbitHub
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Okai. I got the url with hub.challenge=<token> as a querystring.
How should i return this challenge token back to webserver?
Currently i tried with
// Retrieves challengetoken
string challenge = request.QueryString["hub.challenge"];
// Converting the text to byteArray
byte[] challengeBuffer = Encoding.UTF8.GetBytes(challenge);
// Writes buffer into the response body.
Response.Body.Write(challengeBuffer, 0, challengeBuffer.Length);
But this is the result i got..
* upload completely sent off: 117 out of 117 bytes
< HTTP/1.1 500 Internal Server Error
< Server: nginx/1.1.19
< Date: Wed, 13 Nov 2013 05:15:09 GMT
< Content-Length: 0
< Connection: keep-alive
<
* Connection #0 to host xxxx.yyyy.com left intact
* Closing connection #0
What could be the possible error here?
Regards,
Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
From: Brett Cameron
Sent: Wednesday, November 13, 2013 10:07 AM
To: rabbitmq-discuss
Subject: Re: [rabbitmq-discuss] Subscribing an Exchange with RabbitHub
That's correct. As per the documentation you can also specify a duration for the subscription (after which it will be expired), etc.
Just be sure to note that the initial challenge is a GET; messages are then forwarded to the URL using POST.
On 13/11/2013 5:31 PM, "Lijo Sebastian" <lijo at citrusinformatics.com> wrote:
Oh, so can i specify any url as a callback url and satisfy request verification.
any client url that can do verification on this request right?
Regards,
Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
From: Brett Cameron
Sent: Wednesday, November 13, 2013 2:05 AM
To: Discussions about RabbitMQ
Subject: Re: [rabbitmq-discuss] Subscribing an Exchange with RabbitHub
Lijo,
The error indicates that your web server at rabbitmq.citrus.com did not respond correctly to the initial challenge request. When a subscription is requested, RabbitHub sends a challenge request (HTTP GET) to the specified URL. The challenge request sends a token and the web server is expected to respond to the challenge request by sending back the same token in the response body. Assuming this process completes successfully the subscription will be activated. Once the subscription has been activated, RabbitHub will send to the subscription URL any messages matching the subscription (note that messages are sent using HTTP POST, not GET).
Brett
On Wed, Nov 13, 2013 at 1:43 AM, Lijo Sebastian <lijo at citrusinformatics.com> wrote:
Hi,
Please guide me through.
I am using RabbitHub plugin for RESTish way of publishing messages.
Creating and Deleting Exchanges or Queues are working fine.
Also able to publish message with http post method to queues subscribed through amqp.
But how to achieve subscribe with RabbitHub.
I tried the example available with RabbitHub tutorial. Added my call back url . Got Error.
What could be the possibilities of the below shown error?
Thanks in Advance!!!
Error :
Request verification failed: challenge_mismatch* Connection #0 to host rabbitmq
citrus.com left intact
* Closing connection #0
Regards,
Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
----------------------------------------------------------------------------
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
------------------------------------------------------------------------------
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131113/78633487/attachment.htm>
More information about the rabbitmq-discuss
mailing list