Providing APIs for AMQP, Advanced Message Queuing Protocol.
Currently, the library lacks security layer such as TLS and SAML, and transaction support.
Following examples describes how to send and receive messages from remote queues.
(import (rnrs) (net mq amqp api))
;; Sends text message to SAMPLE.QUEUE on localhost:5672
(call-with-amqp-connection "localhost" "5672"
(lambda (conn)
(call-with-amqp-session conn
(lambda (session)
(let ((sender (create-amqp-sender session "SAMPLE.QUEUE"))
(message (create-amqp-text-message "Hello AMQP!!")))
(send-amqp-message sender message)
(destroy-amqp-sender sender))))))
;; Receives text message from SAMPLE.QUEUE on localhost:5672
(call-with-amqp-connection "localhost" "5672"
(lambda (conn)
(call-with-amqp-session conn
(lambda (session)
(let* ((receiver (create-amqp-receiver session "SAMPLE.QUEUE"))
(message (receive-amqp-message receiver)
(destroy-amqp-sender receiver)
message)))))))
Returns #t if given obj is AMQP connection. Otherwise #f.
Creates an AMQP connection object.
Closes given AMQP connection.
Creates an AMQP connection and pass it to proc. Then returns the result of proc.
The created connection will be closed both proc returns or raises an error. Thus Invoking captured continuation inside of proc would not work.
Returns #t if given obj is AMQP session. Otherwise #f.
Starts AMQP session on the given connection
Ends given AMQP session.
Starts an AMQP session and pass it to proc. Then returns the result of proc.
The stated session will be ended both proc returns or raises an error. Thus Invoking captured continuation inside of proc would not work.
Returns #t if given obj is AMQP sender and receiver, respectively. Otherwise #f.
Creates an AMQP sender or receiver, respectively.
source-queue and target-queue must be strings and indicating queue names on the remote server.
Destory given sender and receiver, respectively.
Sends message to sender's queue.
message must be am AMQP message object.
Receives an AMQP message from receiver's queue.
Keyword argument timeout must be #f or integer. If this is specified then the procedure waits only specified milliseconds.
Returns #t if given obj is AMQP message. Otherwise #f.
Creates an AMQP text message, binary message and data message, respectively.
text must be a string. data must be a bytevector. content-type must be a string.