Created
May 25, 2021 00:04
-
-
Save mertyildiran/9f60888d35f444fcf32711d9e5052a10 to your computer and use it in GitHub Desktop.
Mockintosh: mocks for microservice environments - Part 7: Asynchronous Kafka Actors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{ env 'KAFKA_ADDR' 'localhost:9092' }}" | |
actors: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
management: | |
port: 8080 | |
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{ env 'KAFKA_ADDR' 'localhost:9092' }}" | |
actors: | |
- name: Simplest Validating Consumer | |
consume: | |
queue: topic1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{ env 'KAFKA_ADDR' 'localhost:9092' }}" | |
actors: | |
- name: Complex Validating Consumer | |
consume: | |
queue: topic1 | |
key: "{{ regEx 'prefix-(.*)' }}" | |
value: "{{ regEx '(.*)-suffix' }}" | |
headers: | |
client-id: "{{ regEx '[0-9]+' }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
management: | |
port: 8080 | |
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{env 'KAFKA_ADDR' 'localhost:9092'}}" | |
actors: | |
- name: templated-producer | |
produce: | |
queue: templated-producer | |
key: "prefix-{{ random.uuid4 }}" | |
value: "{{ fake.name }}" | |
headers: | |
name: templated | |
constant: constant-value | |
timestamp: "{{ date.timestamp }}" | |
counter: "{{ counter 'kafkaCounter' }}" | |
fromFile: "@templates/example.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
management: | |
port: 8080 | |
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{env 'KAFKA_ADDR' 'localhost:9092'}}" | |
actors: | |
- name: Consumer for the Templated Producer | |
consume: | |
queue: templated-producer | |
- name: templated-producer | |
produce: | |
queue: templated-producer | |
key: "prefix-{{ random.uuid4 }}" | |
value: "{{ fake.name }}" | |
headers: | |
name: templated | |
constant: constant-value | |
timestamp: "{{ date.timestamp }}" | |
counter: "{{ counter 'kafkaCounter' }}" | |
fromFile: "@templates/example.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{ env 'KAFKA_ADDR' 'localhost:9092' }}" | |
actors: | |
- produce: | |
create: true | |
queue: topic2 | |
key: key2 | |
value: value2 | |
headers: | |
hdr2: val2 | |
delay: 2 | |
limit: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{ env 'KAFKA_ADDR' 'localhost:9092' }}" | |
actors: | |
- produce: | |
create: true | |
queue: topic2 | |
key: key2 | |
value: value2 | |
headers: | |
hdr2: val2 | |
delay: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- name: Kafka Mocks | |
type: kafka | |
address: "{{ env 'KAFKA_ADDR' 'localhost:9092' }}" | |
actors: | |
- consume: | |
queue: topic3 | |
delay: 3 | |
produce: | |
queue: topic4 | |
key: key4 | |
value: "value4 and {{ consumed.key }} {{ consumed.value }} {{ consumed.headers.hdr3 }}" | |
headers: | |
hdr4: val4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Random integer: {{ fake.random_int min=10 max=90 step=5 }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment