|
|
@ -170,18 +170,33 @@ with Diagram("Stateful Architecture", show=False):
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
## Using Custom Images
|
|
|
|
## RabbitMQ Consumers with custom nodes
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
```python
|
|
|
|
from diagrams import Diagram
|
|
|
|
from urllib.request import urlretrieve
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from diagrams import Cluster, Diagram
|
|
|
|
from diagrams.custom import Custom
|
|
|
|
from diagrams.custom import Custom
|
|
|
|
|
|
|
|
from diagrams.aws.database import Aurora
|
|
|
|
from diagrams.k8s.compute import Pod
|
|
|
|
from diagrams.k8s.compute import Pod
|
|
|
|
|
|
|
|
|
|
|
|
with Diagram("Custom Node Example", show=False):
|
|
|
|
# Download an image to be used into a Custom Node class
|
|
|
|
pod = Pod("pod")
|
|
|
|
rabbitMQ_url = "https://jpadilla.github.io/rabbitmqapp/assets/img/icon.png"
|
|
|
|
node = Custom("service", "/img/diagrams.png")
|
|
|
|
rabbitMQ_icon = "rabbitmq.png"
|
|
|
|
|
|
|
|
urlretrieve(rabbitMQ_url, rabbitMQ_icon)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with Diagram("Broker Consumers", show=False):
|
|
|
|
|
|
|
|
with Cluster("Consumers"):
|
|
|
|
|
|
|
|
consumers = [
|
|
|
|
|
|
|
|
Pod("worker"),
|
|
|
|
|
|
|
|
Pod("worker"),
|
|
|
|
|
|
|
|
Pod("worker")
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queue = Custom("Message queue", rabbitMQ_icon)
|
|
|
|
|
|
|
|
|
|
|
|
node >> pod
|
|
|
|
queue >> consumers >> Aurora("Database")
|
|
|
|
````
|
|
|
|
````
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|

|
|
|
|