gotthardp / rabbitmq-coap-pubsub

CoAP Publish-Subscribe interface to RabbitMQ
Other
29 stars 4 forks source link

error enabling plugin #1

Closed andreibosco closed 8 years ago

andreibosco commented 8 years ago

I've downloaded the precompiled version of rabbit-coap-pubsub from 'http://www.rabbitmq.com/community-plugins.html', and when I try to enable it I'm getting the following error:

The following plugins have been enabled:
  gen_coap
  rabbitmq_coap_pubsub

Applying plugin configuration to rabbit@caspar... failed.
Error: {noproc,{gen_server,call,
                           [coap_server_registry,
                            {add_handler,[<<"ps">>],rabbit_coap_handler,[]}]}}
michaelklishin commented 8 years ago

Against what RabbitMQ version?

andreibosco commented 8 years ago

Rabbitmq 3.6.0 running on raspbian on a raspberry pi 2. Em 28/02/2016 20:38, "Michael Klishin" notifications@github.com escreveu:

Against what RabbitMQ version?

— Reply to this email directly or view it on GitHub https://github.com/gotthardp/rabbitmq-coap-pubsub/issues/1#issuecomment-189958351 .

gotthardp commented 8 years ago

Strange. Did you download both gen_coap and rabbitmq_coap_pubsub from the website? Could you please post where what rabbitmq-plugins list prints?

andreibosco commented 8 years ago

Yeah, downloaded both of them from the website. Here's the output of rabbitmq-plugins list:

 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   * = running on rabbit@caspar
 |/
[e*] amqp_client                       3.6.0
[  ] cowboy                            1.0.3
[  ] cowlib                            1.0.1
[e*] gen_coap                          0.0.1
[e*] mochiweb                          2.13.0
[  ] rabbitmq_amqp1_0                  3.6.0
[  ] rabbitmq_auth_backend_ldap        3.6.0
[  ] rabbitmq_auth_mechanism_ssl       3.6.0
[E*] rabbitmq_coap_pubsub              0.2.0
[  ] rabbitmq_consistent_hash_exchange 3.6.0
[  ] rabbitmq_event_exchange           3.6.0
[  ] rabbitmq_federation               3.6.0
[  ] rabbitmq_federation_management    3.6.0
[E*] rabbitmq_lvc                      0.0.4
[E*] rabbitmq_management               3.6.0
[e*] rabbitmq_management_agent         3.6.0
[  ] rabbitmq_management_visualiser    3.6.0
[E*] rabbitmq_mqtt                     3.6.0
[  ] rabbitmq_recent_history_exchange  1.2.1
[  ] rabbitmq_sharding                 0.1.0
[  ] rabbitmq_shovel                   3.6.0
[  ] rabbitmq_shovel_management        3.6.0
[  ] rabbitmq_stomp                    3.6.0
[  ] rabbitmq_tracing                  3.6.0
[e*] rabbitmq_web_dispatch             3.6.0
[  ] rabbitmq_web_stomp                3.6.0
[  ] rabbitmq_web_stomp_examples       3.6.0
[  ] sockjs                            0.3.4
[e*] webmachine                        git

If I first enable gen_coap and then rabbitmq_coap_pubsub, no error is shown, but when I get the contents from /.well_known/core nothing is shown, just an empty output (2.05 coap code, no error).

gotthardp commented 8 years ago

Oh. I suspect this is a bug related to the start-up sequence. I will investigate this this evening.

andreibosco commented 8 years ago

Ok. If I can help in any way just let me know.

gotthardp commented 8 years ago

I may have fixed the error. Would you please be able to build the latest version of the rabbitmq-coap-pubsub and test it?

andreibosco commented 8 years ago

Good news: rabbitmq-plugins enable rabbitmq_coap_pubsub works without any error Bad news: still getting an empty output from ./well-known/core.

Here's the output from coap-client coap://127.0.0.1/.well-known/core:

v:1 t:CON c:GET i:b79c {} [ ]
gotthardp commented 8 years ago

Did you create the user anonymous? See README.md.

andreibosco commented 8 years ago

Damn, now I feel stupid. I've read that README over a hundred times and still missed it. I've added a new user called anonymous (password also anonymous), added it to the '/' vhost and now it works. Thank you very much.

Just one last question: all of the example interactions in the README work, but only if I use libcoap. When I try using copper (firefox extension) or coap-cli (ruby) I just get 4.03 (forbidden).

gotthardp commented 8 years ago

Don't worry, it was not well documented in the 'Configuration' section.

I did test it with libcoap only, so there may be troubles with other libraries (which I will fix quickly, once discovered). However I just installed copper and was able to access ./well-known/core. What is it you are trying to access?

gotthardp commented 8 years ago

I found the issue, I guess. You are trying to access a resource in the default virtual host (/), right? There is a bug in copper (I believe). When you type url with %2F, the libcoap correctly encodes it as / while copper sends %2F. And since there is no vhost %2F you get an error. As a workaround you may use a virtual host name without any special character.

Reported as https://github.com/mkovatsc/Copper/issues/14

andreibosco commented 8 years ago

That's it. Both copper and coap-cli can access .well-known/core just fine, but fail when trying to access the default virtual host. I just created a new vhost called test and it worked just fine.

I've followed your lead and opened a bug report on coap-cli: https://github.com/mcollina/coap-cli/issues/11

One last heads up: when I publish to a topic (using any coap client), I get this warning on /var/log/rabbitmq/rabbit@pi.log

=WARNING REPORT==== 3-Mar-2016::08:40:45 ===
Channel (<0.5402.0>): received {{'basic.return',312,<<"NO_ROUTE">>,
                                    <<"topic1">>,<<>>}, {amqp_msg,
                                                         {'P_basic',
                                                          undefined,undefined,
                                                          undefined,1,
                                                          undefined,undefined,
                                                          undefined,
                                                          <<"60000">>,
                                                          undefined,undefined,
                                                          undefined,undefined,
                                                          undefined,undefined},
                                                         <<"teste2">>}} but there is no return handler
 registered
gotthardp commented 8 years ago

Cool! I'm glad it finally works. The warning is a false alarm caused by the mandatory routing flag which we don't really need. I removed the flag so if you build the latest update the warning should disappear.

andreibosco commented 8 years ago

No warnings now, everything is working just fine. Thanks for the patience and for replying so quickly.