This example showcases the use of the HTTP Publisher to call webhooks with HTTP POST requests. It consists of three services:
producerpublishes messages on Kafka. The messages come in three varieties:Foo,Bar, andBaz. The event type is encoded in metadata, under the keyevent_type.webhook_serveris a HTTP server that listens for requests and prints the path, method, and payload on stdout.routerconsumes the Kafka messages, and uses the HTTP producer to send requests towebhook_server. To illustrate how one message can spawn multiple webhooks, the following paths are called based onevent_type:/foofor events of typeFoo/foo_or_barfor events of typeFooorBar/allfor all events.
Additionally, services zookeeper and kafka are present to provide backend for the Kafka producer and subscriber.
To run this example you will need Docker and docker-compose installed. See installation guide at https://docs.docker.com/compose/install/
To run all services, execute:
docker-compose up
To filter messages from a specific service, execute:
docker-compose logs [-f] {service}
in a separate terminal window while the services are running. Use the -f flag to emulate tail -f behavior, i.e. follow the output.