forked from asyncapi/java-spring-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.yml
73 lines (70 loc) · 3.74 KB
/
application.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{%- set hasSubscribe = false -%}
{%- set hasPublish = false -%}
{%- for channelName, channel in asyncapi.channels() -%}
{%- if channel.hasPublish() -%}
{%- set hasPublish = true -%}
{%- endif -%}
{%- if channel.hasSubscribe() -%}
{%- set hasSubscribe = true -%}
{%- endif -%}
{%- endfor -%}
{%- for serverName, server in asyncapi.servers() %}{% if server.protocol() == 'amqp' %}
amqp:
broker: {% for line in server.description() | splitByLines %}
# {{line | safe}}{% endfor %}
host: {% if server.variable('port') %}{{server.url() | replace('{port}', server.variable('port').defaultValue())}}{% else %}{{server.url()}}{% endif %}
port: {% if server.variable('port') %}{{server.variable('port').defaultValue()}}{% endif %}
username: {% if server.variable('username') %}{{server.variable('username').defaultValue()}}{% endif %}
password:
{% for channelName, channel in asyncapi.channels() %}
{{channelName | toAmqpNeutral(channel.hasParameters(), channel.parameters())}}:
{% if channel.binding('amqp') and channel.binding('amqp').exchange %}exchange: {{channel.binding('amqp').exchange.name}}{% endif %}
routingKey: {{channelName | toAmqpKey(channel.hasParameters(), channel.parameters())}}
{% if channel.binding('amqp') and channel.binding('amqp').queue %}queue: {{channel.binding('amqp').queue.name}}{% endif %}
{% endfor %}
{% endif %}
{% if server.protocol() == 'mqtt' %}
mqtt:
broker: {% for line in server.description() | splitByLines %}
# {{line | safe}}{% endfor %}
address: {% if server.variable('port') %}{{server.url() | replace('{port}', server.variable('port').defaultValue())}}{% else %}{{server.url()}}{% endif %}
username:
password:
{% if params.mqttClientId %}
clientId : {{ params.mqttClientId }}
{% elif server.binding('mqtt') and server.binding('mqtt').clientId %}
clientId: {{ server.binding('mqtt').clientId }}
{% else %}
clientId: default
{% endif %}
{% if server.binding('mqtt') and server.binding('mqtt').cleanSession | isDefined %}cleanSession: {{server.binding('mqtt').cleanSession}}{% endif %}
{% if server.binding('mqtt') and server.binding('mqtt').lastWill %}lastWill:
topic: {{server.binding('mqtt').lastWill.topic}}
message: {{server.binding('mqtt').lastWill.message}}
qos: {{server.binding('mqtt').lastWill.qos}}
retain: {{server.binding('mqtt').lastWill.retain}}
{% endif %}
timeout:
completion: {{params.completionTimeout}}
disconnection: {{params.disconnectionTimeout}}
connection: {{params.connectionTimeout}}
{% if server.binding('mqtt') and server.binding('mqtt').keepAlive | isDefined %}keepAlive: {{server.binding('mqtt').keepAlive}}{% endif %}
topic:
{%- for channelName, channel in asyncapi.channels() %}{% if channel.hasPublish() %}
{{channel.publish().id() | camelCase}}: {{channelName | toMqttTopicString(channel.hasParameters(), channel.parameters()) }}
{%- elif channel.hasSubscribe() %}
{{channel.subscribe().id() | camelCase}}: {{channelName}}
{%- endif %}{% endfor %}
{% endif %}{% endfor %}
{%- if asyncapi | isProtocol('kafka') %}
spring:
kafka: {% for serverName, server in asyncapi.servers() %}
# - {{serverName}} in {{server.url()}} : {% for line in server.description() | splitByLines %}
# {{line | safe}}{% endfor %}{% endfor %}
bootstrap-servers: {% for serverName, server in asyncapi.servers() %}{% if server.variable('port') %}{{server.url() | replace('{port}', server.variable('port').defaultValue())}}{% else %}{{server.url()}}{% endif %}{% if not loop.last %},{% endif %}{% endfor %}
{%- if hasPublish %}
listener:
poll-timeout: {{params.listenerPollTimeout}}
concurrency: {{params.listenerConcurrency}}
{% endif %}
{% endif %}