Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d7561985/protonats
Cloud Events NATS extended protocol: opentracing, subject pool for group
https://github.com/d7561985/protonats
cloudevents groups nats opentracing pool protocol subjects
Last synced: 29 days ago
JSON representation
Cloud Events NATS extended protocol: opentracing, subject pool for group
- Host: GitHub
- URL: https://github.com/d7561985/protonats
- Owner: d7561985
- License: mit
- Created: 2021-10-28T18:58:50.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-31T14:16:10.000Z (about 3 years ago)
- Last Synced: 2024-06-20T16:48:07.156Z (5 months ago)
- Topics: cloudevents, groups, nats, opentracing, pool, protocol, subjects
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= Cloud Events NATS protocol
Updated nats protocol for https://github.com/cloudevents/sdk-go/tree/main/protocol/nats/v2
This package extent `opentracing` package for trace carrier
Feature:
* OpenTracing features with "github.com/d7561985/tel" send trace `to` NATS, read tracing span `from` NATS
* Producer uses `context.TopicFrom` feature for overwrite default subject
* Consumer subject pool for group
* Protocol Consumer and Sender struct members are Interfaces and easily could be replaced
* Trace carried within cloudevents payload that's why this allows `TeleObservability` to be ubiquitous for any protocol== Trace feature enable
We use `TeleObservability` correctly read span from NATS and pack it correctly.
But this is only like middleware.All engine pack/unpack under `adapter`
[source,go]
----
package mainimport (
"github.com/d7561985/tel"
"github.com/d7561985/tel/monitoring/metrics"
cenats "github.com/cloudevents/sdk-go/protocol/nats/v2"
cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/cloudevents/sdk-go/v2/client"
"github.com/d7561985/protonats"
)func main() {
t := tel.New(tel.GetConfigFromEnv())p, err := protonats.NewProtocol(env.NATSServer, "-", "", cenats.NatsOptions())
metricsss := metrics.NewCollectorMetricsReader()
ce, err := cloudevents.NewClient(p,
client.WithObservabilityService(protonats.NewTeleObservability(&t, metricsss)),
)}
----== Consumer Subject Group pool
Use option for protocol - `WithConsumerOptions`
[source,go]
----
p, err := protonats.NewProtocol(env.NATSServer, "-", "",
cenats.NatsOptions(),
protonats.WithConsumerOptions(
protonats.WithQueuePoolSubscriber("MyQueue",
"MySubject1", "MySubject2",
),
),
)
----