> For the complete documentation index, see [llms.txt](https://sitecoreuml.gitbook.io/sitecoredxg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sitecoreuml.gitbook.io/sitecoredxg/getting-started/using-sitecoredxg/using-the-default-rabbitmq-middleman-and-trigger.md).

# Using the Default RabbitMQ Middleman and Trigger

The RabbitMQ Middleman can be called from any location using the following command-line syntax:

```
node rabbitmq-amqp-middleman CONNECTION_STRING ARCHITECURE_GET_URL GENERATION_QUEUE_NAME [OPTIONS_FILE_PATH]
```

The middleman's parameters are as follows:

* `CONNECTION_STRING`**:** the RabbitMQ connection string to connect to
* `ARCHITECTURE_GET_URL`**:** the URL to get the serialized template architecture from
* `GENERATION_QUEUE_NAME`**:** the name of the generation queue to add the serialized response to
* `OPTIONS_FILE_PATH`**:** (optional) Path to a JSON file that contains an object that may include a documentation configuration object property and/or completion handlers array property with objects representing the handler ID and parameters for each handler that should be used; For example:&#x20;

{% code title="SampleOptions.json" %}

```javascript
{
    "DocumentationConfiguration": {
        "CommitAuthor": "Zachary Kniebel",
        "CommitHash": "0FE1D344",
        "CommitLink": "http://mygit.com/repo/myrepo/commits/0FE1D344",
        "DeployLink": "http://mydocs.com/foo/bar"
    },
    "CompletionHandlers": [
        {
            "ID": "MyHandler1",
            "Params": {
                "foo": "bar"
            }
        },
        {
            "ID": "MyHandler2"
        }
    ]
} 
```

{% endcode %}

The following examples show how you can call the RabbitMQ middleman on a Habitat instance with the SitecoreUML Service (1.3.6+) installed:

*To retrieve the architecture and add the result to the documentation queue for generation...*

```
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__documentation"
```

*To retrieve the architecture and add the result to the metadata-json queue for generation...*

```
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__mdj"
```

*To retrieve the architecture and add the result to the documentation queue for generation and will tell the Generation Service to call a completion handler named "helloWorld" when finished...*

{% code title="hello-world-sample.json" %}

```javascript
{"CompletionHandlers":[
    {
        "ID":"helloWorld"
    }]
}
```

{% endcode %}

```
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__documentation" "./hello-world-sample.json"
```

*To retrieve the architecture and add the result to the documentation queue for generation and will tell the Generation Service to call the "MyHandler1" completion handler with a parameters object; and then the "MyHandler2" completion handler with no parameters when finished...*

{% code title="handlers-1-2-sample.json" %}

```javascript
{
    "CompletionHandlers": [
        {
            "ID": "MyHandler1",
            "Params": {
                "Count": 1,
                "Max": 2,
                "Hello": "world!",
                "Foo": [ "bar", "baz", 12345 ]
            }
        },
        {
            "ID": "MyHandler2"
        }
    ]
}

```

{% endcode %}

```
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__documentation" "./handlers-1-2-sample.json"
```

[  <br>](https://zkniebel.gitbooks.io/sitecoredxg/content/architecture/architecture-overview.html)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sitecoreuml.gitbook.io/sitecoredxg/getting-started/using-sitecoredxg/using-the-default-rabbitmq-middleman-and-trigger.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
