### Install and Start PHP Example Application Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_http/examples/README.md Commands to install dependencies and start the PHP authentication backend example server. ```shell cd rabbitmq_auth_backend_php/ composer install ``` ```shell composer start ``` -------------------------------- ### Install Dependencies Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_consistent_hash_exchange/examples/python/README.md Install the required Python packages for the examples. ```sh pip install -r ./requirements.txt ``` -------------------------------- ### Install Dependencies Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_consistent_hash_exchange/examples/ruby/README.md Run this command to install the necessary Ruby gems for the examples. ```sh bundle install ``` -------------------------------- ### Launch Python Django Example Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_http/examples/README.md Execute the start script to launch the Django authentication backend application. ```shell start.sh ``` -------------------------------- ### Enable RabbitMQ Web MQTT Examples Plugin Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_web_mqtt_examples/README.md Use this command to enable the RabbitMQ Web MQTT examples plugin. This makes the example server and static files available. ```bash rabbitmq-plugins enable rabbitmq_web_mqtt_examples ``` -------------------------------- ### Example Usage Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_aws/README.md Examples demonstrating how to use the rabbitmq-aws library for making GET and POST requests to AWS services. ```APIDOC ## Example Usage ### GET Request Example ```erlang application:start(rabbitmq_aws). {ok, {Headers, Response}} = rabbitmq_aws:get("ec2","/?Action=DescribeTags&Version=2015-10-01"). ``` ### POST Request Example with Explicit Credentials ```erlang application:start(rabbitmq_aws). rabbitmq_aws:set_credentials("AKIDEXAMPLE", "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"), RequestHeaders = [{"Content-Type", "application/x-amz-json-1.0"}, {"X-Amz-Target", "DynamoDB_20120810.ListTables"}], {ok, {Headers, Response}} = rabbitmq_aws:post("dynamodb", "/", "{\"Limit\": 20}", RequestHeaders). ``` ``` -------------------------------- ### Configure UAA and RabbitMQ Permissions Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_oauth2/README.md Install required dependencies and execute the setup script with necessary environment variables. ```bash gem install cf-uaac gem install bunny RABBITMQCTL= demo/setup.sh ``` -------------------------------- ### Enable Cache Auth Backend (Incomplete) Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_cache/README.md A minimal configuration fragment to enable the cache authentication backend. This example is intentionally incomplete and requires further configuration for a functional setup. ```ini auth_backends.1 = cache ``` -------------------------------- ### Run Example: Hashing on Custom Header Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_consistent_hash_exchange/examples/ruby/README.md Execute this command to run the Ruby example that demonstrates hashing messages based on a custom header. ```sh bundle exec ruby ./example2.rb ``` -------------------------------- ### Start etcd Node for Experimentation Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_peer_discovery_etcd/RUNNING_TESTS.md Starts an etcd node in the background using the provided initialization script. Requires the daemonize tool. ```shell ./test/system_SUITE_data/init-etcd.sh [etcd data dir] [etcd client port] ``` -------------------------------- ### Run Example: Hashing on Routing Key Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_consistent_hash_exchange/examples/ruby/README.md Execute this command to run the Ruby example that demonstrates hashing messages based on their routing key. ```sh bundle exec ruby ./example1.rb ``` -------------------------------- ### Start BrowserSync proxy Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/amqp_client/CONTRIBUTING.md Starts a proxy for the management UI to enable live reloading. ```shell cd deps/rabbitmq_management/priv/www browser-sync start --proxy localhost:15672 --serverStatic . --files . ``` -------------------------------- ### Install npm Packages Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/selenium/README.md Run 'npm install' after updating dependencies in package.json to install the necessary packages. ```bash npm install ``` -------------------------------- ### Start RabbitMQ Node with Plugins Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/amqp10_client/CONTRIBUTING.md Use this command to start a fresh RabbitMQ node with specified plugins enabled. The ENABLED_PLUGINS variable only affects new nodes; existing nodes preserve their plugin configuration. ```shell gmake ENABLED_PLUGINS="rabbitmq_management rabbitmq_stream rabbitmq_stream_management" run-broker ``` -------------------------------- ### Start RabbitMQ Node with Virgin Test Directory Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/amqp10_client/CONTRIBUTING.md This command starts a fresh node, deleting all existing data, with specified plugins enabled. Use this to ensure the ENABLED_PLUGINS variable is applied to a clean environment. ```shell gmake ENABLED_PLUGINS="rabbitmq_management rabbitmq_stream rabbitmq_stream_management" virgin-test-tmpdir run-broker ``` -------------------------------- ### Install Node.js dependencies Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/selenium/README.md Prepares the environment for interactive test execution. ```bash cd selenium npm install ``` -------------------------------- ### Start RabbitMQ Cluster from Source Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_oauth2/CONTRIBUTING.md Starts a multi-node RabbitMQ cluster with specified plugins. The NODES variable determines the cluster size. ```shell # Run from repository root. # Starts a three node cluster with management and two stream plugins enabled gmake NODES=3 ENABLED_PLUGINS="rabbitmq_management rabbitmq_stream rabbitmq_stream_management" start-cluster ``` -------------------------------- ### Example PUT Request for User Limit Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_management/priv/www/api/index.html An example cURL command demonstrating how to set a per-user limit for 'max-connections' for the 'guest' user. ```bash curl -4u 'guest:guest' -H 'content-type:application/json' -X PUT localhost:15672/api/user-limits/guest/max-connections -d '{"value": 50}' ``` -------------------------------- ### Run Example: Hashing on Message Property Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_consistent_hash_exchange/examples/ruby/README.md Execute this command to run the Ruby example that demonstrates hashing messages based on a specific message property. ```sh bundle exec ruby ./example3.rb ``` -------------------------------- ### Initialize Repository Build Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/amqp10_client/CONTRIBUTING.md Standard command to build all subprojects from scratch. ```shell git clean -xfffd && gmake clean && gmake distclean && gmake ``` -------------------------------- ### Get Messages from a Queue Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_management/priv/www/api/index.html Use this to get messages from a queue. Note that this is not an HTTP GET and will alter the queue's state. `truncate` is optional; all other keys are mandatory. ```json {"count":5,"ackmode":"ack_requeue_true","encoding":"auto","truncate":50000} ``` -------------------------------- ### Virtual Host Start API Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_management/priv/www/api/index.html Endpoint for starting a virtual host on a specific node. ```APIDOC ## POST /api/vhosts/_name_/start/_node_ ### Description Starts virtual host _name_ on node _node_. ### Method POST ### Endpoint /api/vhosts/_name_/start/_node_ ``` -------------------------------- ### Run Broker for UI Development Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_internal_loopback/CONTRIBUTING.md Starts a single node with management plugins for local development. ```shell # starts a node with management and two stream plugins enabled gmake run-broker ENABLED_PLUGINS="rabbitmq_management rabbitmq_stream rabbitmq_stream_management" ``` -------------------------------- ### POST /api/queues/_vhost_/_name_/get Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_management/priv/www/api/index.html Get messages from a queue. Note: This is not an HTTP GET as it alters the state of the queue. ```APIDOC ## POST /api/queues/_vhost_/_name_/get ### Description Get messages from a queue. This is intended for diagnostics and does not implement reliable delivery. ### Method POST ### Endpoint /api/queues/_vhost_/_name_/get ### Request Body - **count** (integer) - Required - Maximum number of messages to get. - **ackmode** (string) - Required - Determines if messages are removed (ack_requeue_true, reject_requeue_true, ack_requeue_false, reject_requeue_false). - **encoding** (string) - Required - Must be 'auto' or 'base64'. - **truncate** (integer) - Optional - Truncate message payload if larger than this size in bytes. ### Request Example { "count": 5, "ackmode": "ack_requeue_true", "encoding": "auto", "truncate": 50000 } ``` -------------------------------- ### Install tidy-html5 on macOS Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbit/docs/README.md Use Homebrew to install tidy-html5 on macOS. This is a dependency for processing man pages. ```shell brew install tidy-html5 ``` -------------------------------- ### Extension Metadata Example Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_codegen/README.extensions.md An example of the 'extension' member within an ExtensionDocument, providing informal details about the extension. ```json { "name": "The name of the extension", "version": "1.0", "copyright": "Copyright (C) 1234 Yoyodyne, Inc." } ``` -------------------------------- ### Start RabbitMQ Cluster with Plugins Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/amqp10_client/CONTRIBUTING.md Initiates a multi-node RabbitMQ cluster from source with specified plugins. The NODES variable determines the cluster size. ```shell gmake NODES=3 ENABLED_PLUGINS="rabbitmq_management rabbitmq_stream rabbitmq_stream_management" start-cluster ``` -------------------------------- ### Configure Kubernetes Ordinal Start Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_peer_discovery_k8s/README.md Set this value if the StatefulSet uses a non-default ordinal start index. ```text cluster_formation.k8s.ordinal_start = N ``` -------------------------------- ### Initialize Web STOMP Echo Server Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_web_stomp_examples/priv/echo.html Sets up the UI piping and connects to the RabbitMQ Web STOMP endpoint. ```javascript var has_had_focus = false; var pipe = function(el_name, send) { var div = $(el_name + ' div'); var inp = $(el_name + ' input'); var form = $(el_name + ' form'); var print = function(m, p) { p = (p === undefined) ? '' : JSON.stringify(p); div.append($("").text(m + ' ' + p)); div.scrollTop(div.scrollTop() + 10000); }; if (send) { form.submit(function() { send(inp.val()); inp.val(''); return false; }); } return print; }; // Stomp.js boilerplate const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:'; var client = Stomp.client(wsProtocol + '//' + window.location.hostname + ':15674/ws'); client.debug = pipe('#second'); var print_first = pipe('#first', function(data) { client.send('/topic/test', {"content-type":"text/plain"}, data); }); var on_connect = function(x) { id = client.subscribe("/topic/test", function(d) { print_first(d.body); }); }; var on_error = function() { console.log('error'); }; client.connect('guest', 'guest', on_connect, on_error, '/'); $('#first input').focus(function() { if (!has_had_focus) { has_had_focus = true; $(this).val(""); } }); ``` -------------------------------- ### Start rabbitmq_aws Application Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_aws/README.md Ensures the rabbitmq_aws application is started before making API calls. This is a prerequisite for most operations. ```erlang application:start(rabbitmq_aws). ``` -------------------------------- ### Run Spring Boot Kotlin Backend Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin/README.md Execute this command to start the backend application. Ensure RabbitMQ is configured to work with the backend. ```bash ./mvnw spring-boot:run ``` -------------------------------- ### Install BrowserSync Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/amqp10_client/CONTRIBUTING.md Installs BrowserSync globally using NPM. BrowserSync is a tool for live reloading and proxying during web development. ```shell npm install -g browser-sync ``` -------------------------------- ### Configure BrowserSync for UI development Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_event_exchange/CONTRIBUTING.md Install and run BrowserSync to enable live reloading for management UI development. ```shell npm install -g browser-sync ``` ```shell cd deps/rabbitmq_management/priv/www browser-sync start --proxy localhost:15672 --serverStatic . --files . ``` -------------------------------- ### Computed Scopes Example Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_oauth2/README.md Example of the scopes computed from the rich authorization request when the RabbitMQ node's resource_server_id is 'finance'. ```plaintext finance.read:primary-*/*/* finance.write:primary-*/*/* finance.configure:primary-*/*/* finance.tag:administrator ``` -------------------------------- ### Run Consistent Hash Examples Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_consistent_hash_exchange/examples/python/README.md Execute the provided Python scripts to demonstrate different hashing strategies. ```sh # hashing on the routing key python ./example1.py # hashing on a custom header python ./example2.py # hashing on a message property python ./example3.py ``` -------------------------------- ### Stop RabbitMQ Cluster Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/amqp10_client/CONTRIBUTING.md Shuts down a previously started RabbitMQ cluster. The NODES variable should match the number of nodes started. ```shell gmake stop-cluster NODES=3 ``` -------------------------------- ### Initialize Web STOMP Client and Handle Temporary Queues Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_web_stomp_examples/priv/temp-queue.html Sets up a WebSocket connection, defines the debug and receive callbacks, and manages message subscription and reply logic. ```javascript var ws = new WebSocket('ws://' + window.location.hostname + ':15674/ws'); var client = Stomp.over(ws); client.debug = function(e) { $('#second div').append($("").text(e)); }; // default receive callback to get message from temporary queues client.onreceive = function(m) { $('#first div').append($("").text(m.body)); } var on_connect = function(x) { id = client.subscribe("/queue/test", function(m) { // reply by sending the reversed text to the temp queue defined in the "reply-to" header var reversedText = m.body.split("").reverse().join(""); client.send(m.headers['reply-to'], {"content-type":"text/plain"}, reversedText); }); }; var on_error = function() { console.log('error'); }; client.connect('guest', 'guest', on_connect, on_error, '/'); $('#first form').submit(function() { var text = $('#first form input').val(); if (text) { client.send('/queue/test', {'reply-to': '/temp-queue/foo'}, text); $('#first form input').val(""); } return false; }); ``` -------------------------------- ### Start a RabbitMQ Cluster Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_internal_loopback/CONTRIBUTING.md Initializes a multi-node cluster with specific plugins enabled. ```shell gmake start-cluster NODES=3 ENABLED_PLUGINS="rabbitmq_management rabbitmq_stream rabbitmq_stream_management" ``` -------------------------------- ### Implement init/1 in Printer Module Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_cli/DESIGN.md Example of the init/1 function within a printer module. This function initializes the printer's internal state, such as opening a file handler. ```elixir init(options :: Map.t) :: {:ok, printer_state :: any} | {:error, error :: any} ``` -------------------------------- ### Rich Authorization Request Example Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_oauth2/README.md An example of a rich authorization request JSON payload, demonstrating the structure for specifying RabbitMQ resource access permissions. ```json { "authorization_details": [ { "type" : "rabbitmq", "locations": ["cluster:finance/vhost:primary-*"], "actions": [ "read", "write", "configure" ] }, { "type" : "rabbitmq", "locations": ["cluster:finance", "cluster:inventory"], "actions": ["administrator" ] } ] } ``` -------------------------------- ### RabbitMQ Streams Request/Response Key Example Source: https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_stream/docs/PROTOCOL.adoc Illustrates how the most significant bit of a uint16 key differentiates between a request (0) and a response (1). Example shown for the 'subscribe' command (key 6). ```plaintext 0x0006 => subscribe request 0x8006 => subscribe response ```