foo:bar
is straightforward. All messages the server receives on subject foo
are remapped and can be received by clients subscribed to bar
.nats-server
) {{wildcard(position)}}
. E.g. {{wildcard(1)}}
references the first wildcard token, {{wildcard(2)}}
references the second wildcard token, etc...nats-server
) use the legacy notation of $position
. E.g. $1
references the first wild card token, $2
the second wildcard token, etc..."bar.*.*" : "baz.{{wildcard(2)}}.{{wildcard(1)}}"
, messages that were originally published to bar.a.b
are remapped in the server to baz.b.a
. Messages arriving at the server on bar.one.two
would be mapped to baz.two.one
, and so forth.neworders.<customer id>
, you can partition those messages over 3 partition numbers (buckets), using the partition(number of partitions, wildcard token positions...)
function which returns a partition number (between 0 and number of partitions-1) by using the following mapping "neworders.*" : "neworders.{{wildcard(1)}}.{{partition(3,1)}}"
.neworders.<customer id>
will be mapped to neworders.<customer id>.<a partition number 0, 1, or 2>
. i.e.:{{partition(10,1,2)}}
distributes the union of token wildcards 1 and 2 over 10 partitions.neworders.*
) into three separate subscribers (respectively on neworders.*.0
, neworders.*.1
and neworders.*.2
) that can operate in parallel.myservice.requests
. The responders doing the work of the server would subscribe to myservice.requests.v1
. Your configuration would look like this:myservice.requests
will go to version 1 of your service.myservice.requests.v2
. Launch instances of your service.myservice.requests
to version 2 of your service.myservice.requests.*: [{ destination: myservice.requests.$1, weight: 80% }, { destination: myservice.requests.fail.$1, weight: 20% }
foo.loss.a
would be artificially dropped by the server.foo.loss.>: [ { destination: foo.loss.>, weight: 50% } ]
myservice.requests: [{ destination: myservice.requests.v3, weight: 90% }, { destination: myservice.requests.v3.fail, weight: 8% }]
the remaining 2% is "lost"