as-a-proxy

command
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 6 Imported by: 0

README

Usage as a proxy

Async microservice

If you have a microservice which does not support rest, but rather just listens to topics and responds to other topics like the example file main.go.

In the main.go provided as an example, we are listening on testing.in while sending the response back to testing.out.

$ go run main.go

Then we can run kafka-sync-proxy as a service using the binary or docker.

$ go install github.com/sarkarshuvojit/kafka-sync-proxy
$ kafka-sync-proxy

Then you can fire requests using a curl similar to the following:

curl --location --request POST 'http://localhost:8420/v1/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "requestTopic": "testing.in",
    "responseTopic": "testing.out",
    "payload": {
        "message": "testing the proxy",
        "nested": {
            "child": {
                "subChild": 42
            }
        }
    },
    "headers": {
        "customAuthHeader": "ggg"
    },
    "brokers": [
        "localhost:29092"
    ]
}'

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL