Re: [racket-users] RCP over racket-stomp
On 08/07/2015 12:43 PM, Jukka Tuominen wrote: Disconnected before receipt R14642 was received What shows up in the RabbitMQ logs around the time that the disconnection happens? Often a bunch of detail is logged that is not passed on to the connected client. Tony I found this: =INFO REPORT 7-Aug-2015::22:00:21 === accepting STOMP connection 0.5761.4 ([client-ip]:59326 - [server-ip]:61613) =ERROR REPORT 7-Aug-2015::22:00:25 === Channel error on connection 0.5764.4 ([client-ip]:59326 - [server-ip]:61613, vhost: '/', user: 'device7'), channel 1: {amqp_error,access_refused, access to queue 'amq.gen--sUYfl-1_IbdAXhs8LwoUA' in vhost '/' refused for user 'device7', 'basic.consume'} =ERROR REPORT 7-Aug-2015::22:00:25 === STOMP error frame sent: Message: access_refused Detail: ACCESS_REFUSED - access to queue 'amq.gen--sUYfl-1_IbdAXhs8LwoUA' in vhost '/' refused for user 'device7'\n Server private detail: none =INFO REPORT 7-Aug-2015::22:00:25 === closing STOMP connection 0.5761.4 ([client-ip]:59326 - [server-ip]:61613) PS. I tried to get RabbitMQ+STOMP running yesterday and failed to get it to go, full stop! Surprising permissions errors. Which was, uh, *unexpected*, considering. I'll have another try over the weekend, if I get a chance. Hehe, comforting but scary at the same time to hear that it can happen to you too :) br, jukka -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] RCP over racket-stomp
For testing purposes, I changed the permissions to ^.* .* '* which got rid of the error messages. However, there is still no reply eventhough the message is received by the target computer. Hmmm, in this case both SUB and PUB are device7 should it matter. br, jukka On 08/07/2015 03:19 PM, Jukka Tuominen wrote: =ERROR REPORT 7-Aug-2015::22:00:25 === Channel error on connection 0.5764.4 ([client-ip]:59326 - [server-ip]:61613, vhost: '/', user: 'device7'), channel 1: {amqp_error,access_refused, access to queue 'amq.gen--sUYfl-1_IbdAXhs8LwoUA' in vhost '/' refused for user 'device7', 'basic.consume'} Based on this, I think a productive line of investigation would be to see if using the permissions-configuration stuff from rabbitmqctl might help. The server is claiming that user device7 is not permitted to read from queues with server-generated names. Since I haven't managed to get even basic STOMP messaging working myself, I'm not the best person to ask about exactly how to do this, of course :-) but https://www.rabbitmq.com/access-control.html might get you started... Tony -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] RCP over racket-stomp
Tony, having experimented with your code to catch `exn:stomp` exception, this is what I got first: Disconnected before receipt R14642 was received There are two sends in the code, and it is actually the second call that causes the error. With a single send, no error is signalled but nothing is retuned either. Taking away (receipt ,receipt) from send had no effect. br, jukka On 08/06/2015 02:03 PM, Jukka Tuominen wrote: From a generic STOMP documentation I’ve understood that I should send a ”reply-to” header item with a temporary queue value, but I’m not sure about the format I should use in racket-stomp. I tried... #:headers `((receipt ,receipt)(persistent true)(reply-to /temp-queue/foo)) ... which returned ”Received ERROR” without further information. You need to catch the `exn:stomp` exception, which includes the error frame; untested example code: (with-handlers [(exn:stomp? (lambda (e) (log-error STOMP error ~v (exn:stomp-frame e] ...) Also, it is a good idea to check the logs of whichever broker you are using. Also, even though the target computer is able to receive the message, I’m not sure how to make it to respond with a value. Which broker are you using? Cheers, Tony -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] RCP over racket-stomp
On 08/07/2015 03:19 PM, Jukka Tuominen wrote: =ERROR REPORT 7-Aug-2015::22:00:25 === Channel error on connection 0.5764.4 ([client-ip]:59326 - [server-ip]:61613, vhost: '/', user: 'device7'), channel 1: {amqp_error,access_refused, access to queue 'amq.gen--sUYfl-1_IbdAXhs8LwoUA' in vhost '/' refused for user 'device7', 'basic.consume'} Based on this, I think a productive line of investigation would be to see if using the permissions-configuration stuff from rabbitmqctl might help. The server is claiming that user device7 is not permitted to read from queues with server-generated names. Since I haven't managed to get even basic STOMP messaging working myself, I'm not the best person to ask about exactly how to do this, of course :-) but https://www.rabbitmq.com/access-control.html might get you started... Tony -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] RCP over racket-stomp
I have installed a RabbitMQ server for Liitin project (http://liitin.org) to develop and test various messaging possibilities between users and various devices and services (Internet of Things). So far I have a very small toy program to publish and subscribe to dummy notifications. Now I'd like to modify the code for cases when needing to make more direct enquiries or remote controls with a feedback. Here is what I have so far. Anybody is free to test it until I change the password :) ; SUB XX ;;; Have this running in one DrRacket tab, before running the PUB in another tab. ;;; Then switch back to SUB to see the incoming notifications #lang racket (require (planet main.rkt (tonyg stomp.plt 3 2))) (require mzlib/string) ;;; DEVICE SUBSCRIPTION (define (my-message-handler message) (define disarmed-message (read-from-string (bytes-string/utf-8 (stomp-frame-body message (define signer unknown); extract from signed (open-air) message (define timestamp unknown); extract when the package was wrapped (define interpreter car) (define arguments cdr) (when (list? disarmed-message); ignore others (begin (display You received a new message signed by ') (display signer)(display ' dated ')(display timestamp)(display ': )(print disarmed-message)(newline); Add signed by... (cond ((equal? 'store-photo (interpreter disarmed-message)) (thread (lambda () (display This places a new photo to your photo album)(newline)(newline; (eval disarmed-message); Eval reguires Liitin environment ((equal? 'pull-request (interpreter disarmed-message)) (thread (lambda () (display This is a pull-request)(newline)(newline; (eval disarmed-message); Eval reguires Liitin environment ((equal? 'instant-notification (interpreter disarmed-message)) (thread (lambda () (display This is an instant notification)(newline)(newline; (eval disarmed-message); Eval reguires Liitin environment ((equal? 'device-settings (interpreter disarmed-message)) (thread (lambda () (display These are the current settings for the specified device)(newline)(newline; (eval disarmed-message); Eval reguires Liitin environment (define (listen-to-my-messages) (define credientials (stomp-connect liitin.org #:login device7 #:passcode Guest313 #:virtual-host /)); #:headers, #:login, #:passcode, #:port-number, #:request-versions, and #:virtual-host (stomp-subscribe credientials /queue/device7.default my-subscription #:ack-mode 'auto #:headers '((persistent true))); verify format! Also, prohibit listening others! (thread (lambda () (let loop () (let ((open-air-message (stomp-next-message credientials my-subscription))); I.e, this is seen outside world, so secure it! (my-message-handler open-air-message); filters out anything else (loop) (display Listening new messages...)(newline)(newline)) (listen-to-my-messages) ; PUB XX #lang racket (require (planet main.rkt (tonyg stomp.plt 3 2))) ;;; PUBLICATION (define credientials (stomp-connect liitin.org #:login device7 #:passcode Guest313 #:virtual-host /)) (define (default-address recipient) (string-append /queue/ recipient .default)) (define (my-encrypt-signer data) data); place-holder only for now! (define (wrap sender recipient-list encrypt-signer data) (list sender (current-seconds) recipient-list (encrypt-signer data))) (define (send-default-message recipient secured-message) (call-with-receipt credientials (lambda (receipt) (stomp-send credientials (default-address recipient) (string-bytes/utf-8 secured-message) #:headers `((receipt ,receipt)(persistent true)); verify format! ;(stomp-send credientials (default-address recipient) (string-bytes/utf-8 secured-message) #:headers `((receipt ,receipt)(persistent true)(reply-to /temp-queue/foo)); verify format! ;; TESTING (define secured-message1 (store-photo photo from-device7)); place-holder only for now. Sign and encrypt before placing open air. (define secured-message2 (pull-request target-object replacement-object description from-device7)); place-holder only for now. Sign and encrypt also before placing open air. (define secured-message3 (instant-notification notification-content from-device7)); place-holder only for now. Sign and encrypt also before placing open air. (define secured-message4 (device-settings device-x from-device7)); place-holder only for now. Sign and encrypt also before placing open air. (sleep 3) (send-default-message device7 secured-message1);This goes open air - be sure to secure the message before sending it! (sleep 5) (send-default-message device7 secured-message2) (sleep 5) (stomp-disconnect credientials) ;XX END XX br, jukka On 08/06/2015 02:03 PM, Jukka Tuominen wrote: From a generic STOMP
Re: [racket-users] RCP over racket-stomp
On 08/06/2015 02:03 PM, Jukka Tuominen wrote: From a generic STOMP documentation I’ve understood that I should send a ”reply-to” header item with a temporary queue value, but I’m not sure about the format I should use in racket-stomp. I tried... #:headers `((receipt ,receipt)(persistent true)(reply-to /temp-queue/foo)) ... which returned ”Received ERROR” without further information. You need to catch the `exn:stomp` exception, which includes the error frame; untested example code: (with-handlers [(exn:stomp? (lambda (e) (log-error STOMP error ~v (exn:stomp-frame e] ...) Also, it is a good idea to check the logs of whichever broker you are using. Also, even though the target computer is able to receive the message, I’m not sure how to make it to respond with a value. Which broker are you using? Cheers, Tony -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.