---
sources:
  rt_transactions_socket:
    type: socket
    path: /var/run/vector/vector_rt.sock
    socket_file_mode: 666
    mode: "unix_stream"
    decoding:
      codec: "json"

transforms:
  rt_transactions_routing:
    type: "route"
    inputs: [ "rt_transactions_socket" ]
    route:
{% for nats_input in rt.nats.inputs %}
      "{{ nats_input }}": .Queue == "{{ nats_input | capitalize }}"
{% endfor %}

sinks:
{% for nats_input in rt.nats.inputs %}
  rt_transactions_nats_{{ nats_input }}:
    inputs: [ "rt_transactions_routing.{{ nats_input }}" ]
    type: "nats"
    url: "{{ rt.nats.url }}"
    subject: "rt_transactions{{ '_development' if nats_input == 'development' else '' }}"
    jetstream: true
    buffer:
      type: disk
      max_size: 1073741952 # 1G
      when_full: drop_newest
    auth:
      strategy: "user_password"
      user_password:
        user: "{{ rt.nats.username }}"
        password: "{{ rt.nats.password }}"
    encoding:
        codec: "json"

{% endfor %}
