Using the Default RabbitMQ Middleman and Trigger
The RabbitMQ Middleman can be called from any location using the following command-line syntax:
1
node rabbitmq-amqp-middleman CONNECTION_STRING ARCHITECURE_GET_URL GENERATION_QUEUE_NAME [OPTIONS_FILE_PATH]
Copied!
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:
SampleOptions.json
1
{
2
"DocumentationConfiguration": {
3
"CommitAuthor": "Zachary Kniebel",
4
"CommitHash": "0FE1D344",
5
"CommitLink": "http://mygit.com/repo/myrepo/commits/0FE1D344",
6
"DeployLink": "http://mydocs.com/foo/bar"
7
},
8
"CompletionHandlers": [
9
{
10
"ID": "MyHandler1",
11
"Params": {
12
"foo": "bar"
13
}
14
},
15
{
16
"ID": "MyHandler2"
17
}
18
]
19
}
Copied!
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...
1
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__documentation"
Copied!
To retrieve the architecture and add the result to the metadata-json queue for generation...
1
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__mdj"
Copied!
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...
hello-world-sample.json
1
{"CompletionHandlers":[
2
{
3
"ID":"helloWorld"
4
}]
5
}
Copied!
1
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__documentation" "./hello-world-sample.json"
Copied!
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...
handlers-1-2-sample.json
1
{
2
"CompletionHandlers": [
3
{
4
"ID": "MyHandler1",
5
"Params": {
6
"Count": 1,
7
"Max": 2,
8
"Hello": "world!",
9
"Foo": [ "bar", "baz", 12345 ]
10
}
11
},
12
{
13
"ID": "MyHandler2"
14
}
15
]
16
}
Copied!
1
node rabbitmq-amqp-middleman amqp://localhost http://local.habitat.com/sitecoreuml/sitecoredxg/GetTemplateArchitecture "generation_queue__documentation" "./handlers-1-2-sample.json"
Copied!
Last modified 2yr ago
Copy link