as-a-lib

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: 3 Imported by: 0

README

Using as a library

Use case

Let's say in while you're developing some api there comes a need to produce a message to a topic, but for this specific case, your code also needs some confirmation which comes to a different topic altogether.

We can argue that the response is better sent later using sse/ws, but let's assume there's something that's blocking us from doing that.

In that case, it will be very easy to use this as a client to consume respone from a request-response pattern.

Tutorial

Initialising the blocking service
// List of brokers is required to initialise our kafka provider
brokers := []string{"localhost:29092"}

// Later we will have multiple provider types like redis/rabbitmq
provider := kafka.Kafka{Brokers: brokers}

// finally create the service
service := service.BlockingService{Provider: provider}
Initiate request-reply operation
response, err := service.RequestResponseBlock("requestTopic", "responseTopic", "{}", "{}")

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