Last active
February 16, 2024 13:52
-
-
Save natritmeyer/5966730 to your computer and use it in GitHub Desktop.
Get messages off a RabbitMQ... Queue!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
require 'json' | |
class QueueInspector | |
include HTTParty | |
basic_auth "guest", "guest" | |
base_uri "http://192.168.0.1:55672" | |
def messages | |
body = {'count' => 5,'requeue' => true, 'encoding' => 'auto', 'truncate' => 50000}.to_json | |
headers = {"Content-Type" => "application/json"} | |
options = {body: body, headers: headers} | |
self.class.post "/api/queues/%2f/my_queue/get", options | |
end | |
end | |
response = QueueInspector.new.messages | |
puts response.code | |
puts response.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -i -X POST -u guest:guest http://192.168.0.1:55672/api/queues/%2f/my_queue/get -H "Content-Type: application/json" -d '{"count":5,"requeue":true,"encoding":"auto","truncate":50000}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment