During some configurations with Kafka, I was at a point where I need a different group id for each instance of the same service.
So to set up it, I looked for how I can make prefixed group ids. And I found this.
In your application.properties or in your application.yaml, you can use the next functions to generate random values.
# Random int
a=${random.int}
# Random int with a maximum value
b=${random.int(1000)}
# Random int in a range
c=${random.int[0, 9999])}
# Random long with a maximum value
d=${random.long(100000000000000000)}
# Random long in a range
e=${random.long[10000, 999999999999999999])}
# Random 32 bytes value
f=${random.value}
# Random UUID
g=${random.uuid}
And if you want, you can use them in the middle of a string.
h=test-${random.int}-value
I hope it will help you!
Don't hesitate to give some feedback to help me to improve my writing skills. Thanks!
Top comments (3)
Very interesting tip, thanks for sharing.
I couldn't get the range examples to work . . . even after adding the missing left parentheses.
Did you add it in your applilcationn.yaml file?