[rabbitmq-discuss] rabbitmq-mochiweb
Tony Garnock-Jones
tonyg at lshift.net
Fri Apr 23 04:55:45 BST 2010
Not *quite* what is required, but a good start, is to run "rabbitmqctl status".
For instance, on my dev instance of RabbitMQ, I get:
~/dev/rabbitmq-umbrella/rabbitmq-server$ ./scripts/rabbitmqctl status
Status of node rabbit at walk ...
[{running_applications,
[{rabbit_lvc_plugin,"RabbitMQ last-value cache exchange plugin","0.01"},
{rabbit_script_exchange,"RabbitMQ Script Exchange Plugin","0.01"},
{rfc4627_jsonrpc,"JSON RPC Service","0.01"},
{rabbitmq_smtp_server,"RabbitMQ SMTP Server","0.0"},
{rabbithub,"rabbithub","0.0.1"},
{crypto,"CRYPTO version 1","1.6.4"},
{mochiweb,"MochiMedia Web Server","0.01"},
{rabbit_stomp,"Embedded Rabbit Stomp Adapter","0.01"},
{rabbit,"RabbitMQ","%%VSN%%"},
{rabbit_mochiweb,"RabbitMQ Mochiweb Embedding","0.01"},
{mnesia,"MNESIA CXC 138 12","4.4.13"},
{os_mon,"CPO CXC 138 46","2.2.5"},
{sasl,"SASL CXC 138 11","2.1.9"},
{erlang_smtp,"Erlang POP3 and SMTP server library code","0.0"},
{stdlib,"ERTS CXC 138 10","1.16.5"},
{kernel,"ERTS CXC 138 10","2.13.5"}]},
{nodes,[rabbit at walk]},
{running_nodes,[rabbit at walk]}]
...done.
You'll see the jsonrpc-channel app in the list, if it's installed and
initialised correctly.
Cheers,
Tony
Benjamin Polidore wrote:
> hey, i can't seem to get past this. i'm probably doing something silly,
> but i keep getting:
>
> {"version":"1.1","id":null,"error":{"name":"JSONRPCError","code":404,"message":"Procedure not found","error":["http://h5pro.local:55672/rpc/rabbitmq",""]}}
>
> when i run the test.js from my mac's apache server. is there a dead simple way to test that jsonrpc-channel is working when it's running as a plugin?
>
>
> On Sun, Apr 18, 2010 at 2:31 PM, Benjamin Polidore <polidore at gmail.com
> <mailto:polidore at gmail.com>> wrote:
>
> Thanks, Paul. I decided not to mess with the source code, and I'm
> just using OS X's built in apache for my static files.
>
> Now I'm getting a different problem. I modified the test program to
> work in this new context by changing the paths for loading the
> javascripts and changing the urls in rabbitmq.js:
>
> factoryServiceUrl: *"http://h5pro.local:55672/rpc/rabbitmq",*
> rpcServiceUrlBase*: "http://h5pro.local:55672/rpc/",*
>
> and in test.js:
>
> var channelFactory = new
> JsonRpc.Service("*http://h5pro.local:55672/rpc/rabbitmq", *
>
> But it doesn't work. When I do an ngrep on the traffic going
> between my js and mochiweb, I get:
>
> T 10.0.1.3:60988 <http://10.0.1.3:60988> -> 10.0.1.3:55672
> <http://10.0.1.3:55672> [AP]
> OPTIONS /rpc/rabbitmq HTTP/1.1..Host:
> h5pro.local:55672..Connection: keep-alive..User-Agent: Mozilla/5.0
> (Macintosh; U; Intel Mac OS X 10_6_3; e
> n-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.9
> Safari/533.4..Referer:
> http://h5pro.local/~bp/rabbitTest/www-examples/test/..Access
> -Control-Request-Method: POST..Origin:
> http://h5pro.local..Access-Control-Request-Headers:
> X-Requested-With, Content-Type, Accept..Accept: */*..
> Accept-Encoding: gzip,deflate,sdch..Accept-Language:
> en-US,en;q=0.8..Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3....
>
> ##
> T 10.0.1.3:55672 <http://10.0.1.3:55672> -> 10.0.1.3:60988
> <http://10.0.1.3:60988> [AP]
> HTTP/1.1 200 OK..Server: MochiWeb/1.0 (Any of you quaids got a
> smint?)..Date: Sun, 18 Apr 2010 18:27:48 GMT..Content-type:
> text/plain..Content-L
> ength: 155....
>
>
> ##
> T 10.0.1.3:55672 <http://10.0.1.3:55672> -> 10.0.1.3:60988
> <http://10.0.1.3:60988> [AP]
> {*"version":"1.1","id":null,"error":{"name":"JSONRPCError","code":404,"message":"Procedure
> not found","error":["http://h5pro.local:55672/rpc/rabb itmq",""]}} *
> *
> *
> *Thoughts? *
> *
> Thanks,
> bp *
>
> On Sat, Apr 17, 2010 at 6:46 PM, Paul Jones <pauljones23 at gmail.com
> <mailto:pauljones23 at gmail.com>> wrote:
>
> Hi Benjamin,
>
> In the production mode, mochiweb doesn't really have a docroot
> setup. /rabbitmq_lib will serve the files in priv/www, but that
> is as far as it goes.
>
> However... if you want to serve some other files then you could
> always use code similar to what the test mode does to make it
> happen. For example, if you were to add:
>
> Handler = rabbit_mochiweb:static_context_handler("", ?MODULE,
> "priv/mydocroot"),
> ok = rabbit_mochiweb:register_global_handler(Handler),
>
> after the line:
> rabbit_mochiweb:register_static_context(ContextRoot, ?MODULE,
> "priv/www")
>
> in src/rabbit_jsonrpc_channel_app.erl, then once you've
> installed the plugin into Rabbit, any file put into
> priv/plugins/rabbitmq-jsonrpc-channel/priv/mydocroot should be
> served from the root context of mochiweb.
>
> BTW, I've just noticed a bug in the packaging of the
> jsonrpc-channel plugin such that if you do run that plugin by
> installing it via a .ez, you'll need to copy the priv/www
> directory into priv/plugins/rabbitmq-jsonrpc-channel/priv/www
> (otherwise libraries such as rabbitmq.js won't be available).
>
> Thanks,
> Paul.
>
>
> On Sat, Apr 17, 2010 at 11:29 PM, Benjamin Polidore
> <polidore at gmail.com <mailto:polidore at gmail.com>> wrote:
>
> Hey, paul, I installed all the dependencies to
> rabbitmq-jsonrpc-channel (see below).
>
> I see that you add a little context in test mode.
> Basically, I was hoping to use the plugin to host my HTML
> and javascript in dev mode so I don't have to run another
> webserver on my laptop. I prefer to run rabbitmq in
> "production" mode on my laptop, and I was curious what
> mochiweb thinks the docroot is in this mode.
>
> [{running_applications,
> [{rabbit_jsonrpc_channel,"RabbitMQ JSON-RPC
> Channels","0.01"},
> {rabbit,"RabbitMQ","1.7.2"},
> {os_mon,"CPO CXC 138 46","2.2.5"},
> {sasl,"SASL CXC 138 11","2.1.9"},
> {rabbit_jsonrpc,"Rabbit JSON-RPC","0.01"},
> {rfc4627_jsonrpc,"JSON RPC Service","0.01"},
> {rabbit_mochiweb,"RabbitMQ Mochiweb Embedding","0.01"},
> {mochiweb,"MochiMedia Web Server","0.01"},
> {mnesia,"MNESIA CXC 138 12","4.4.13"},
> {stdlib,"ERTS CXC 138 10","1.16.5"},
> {kernel,"ERTS CXC 138 10","2.13.5"}]},
> {nodes,[rabbit at H5Pro]},
> {running_nodes,[rabbit at H5Pro]}]
> ...done.
>
>
> On Sat, Apr 17, 2010 at 4:11 PM, Paul Jones
> <pauljones23 at gmail.com <mailto:pauljones23 at gmail.com>> wrote:
>
> Hi Benjamin,
>
> Which plugins have you installed into RabbitMQ? The
> mochiweb plugin alone simply embeds a webserver - you'll
> need to install rabbitmq-jsonrpc and
> rabbitmq-jsonrpc-channel to get the JSON services.
>
> If you have done this, then you might be hitting the
> fact that when running under test, an additional context
> is installed under the root that provides all the
> various test examples. We don't activate this in the
> "production" mode, since we don't expect you'll want
> them in a real deployment. The scripts for doing
> JSON-RPC are still there though - under /rabbitmq_lib
> (the scripts that are made available via this can be
> found on the filesystem in priv/www).
>
> I hope this answers your question.
>
> Cheers,
> Paul
>
> On Sat, Apr 17, 2010 at 8:28 PM, Benjamin Polidore
> <polidore at gmail.com <mailto:polidore at gmail.com>> wrote:
>
> hi, i'm trying to use the json-channel plugin, and
> it runs ok when i do make test, but it doesn't seem
> to work when i try to start up my broker. the port
> is open, but everything returns 404. what is
> mochiweb using as a docroot when I run it outside
> make test? sorry if this is obvious, but i've been
> struggling with it for a couple hours.
>
> thanks,
> bp
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> <mailto:rabbitmq-discuss at lists.rabbitmq.com>
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list