blob: c803d41d94a2e81c547cba57de4182b4b70e9b23 [file] [log] [blame]
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License
////
// Module is included in the following assemblies:
//
// configuring-network-connections.adoc
[id='adding-metadata-to-connections-{context}']
= Adding metadata to connections
In a complex topology, it can be useful to add metadata to connections so that messages can be handled programmatically.
.Procedure
include::{FragmentDir}/fragment-router-open-config-file-step.adoc[]
. Add arbitrary JSON to the `connector` configuration using the 'openProperties' attribute.
+
--
This example adds the property `label` with the value `green`.
[options="nowrap",subs="+quotes"]
----
connector {
name: broker
role: route-container
host: 127.0.0.1
port: 22180
saslMechanisms: ANONYMOUS
openProperties: {
"label": "green"
}
}
----
Note the following restrictions on the JSON entries:
* ASCII characters only for keys
* The following keys are not allowed:
** product
** version
** failover-server-list
** network-host
** port
** scheme
** hostname
** any key starting with `qd.`
** any key starting with `x-opt-qd.`
The `openProperties` attribute can only be set for a connector with a `normal` or `route-container` role.
You cannot set the attribute for connectors that have the following settings:
* `role: inter-router`
* `role: edge`
* `http: true`
The JSON format supports lists, maps and multiple entries, for example:
----
connector {
name: broker
role: route-container
host: 127.0.0.1
port: 22180
saslMechanisms: ANONYMOUS
openProperties: {
"foo": "bar",
"integer": 7,
"list": ["a", 1, "b", -9, true],
"map": {"key1": null, "key2": [1, 2, 3]},
}
cost: 10
}
----
--