{"id":34527646,"url":"https://github.com/eclipse-xfsc/cloud-event-provider","last_synced_at":"2026-05-28T22:31:30.273Z","repository":{"id":288957997,"uuid":"963958091","full_name":"eclipse-xfsc/cloud-event-provider","owner":"eclipse-xfsc","description":"This library is used for abstracting messaging. The purpose of this library shall be to decapsulate message bus technologies from their usage. So it's doesnt matter if nats, kafka or anything else supported is used.","archived":false,"fork":false,"pushed_at":"2025-10-27T17:39:08.000Z","size":95,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-05-12T17:36:52.971Z","etag":null,"topics":["cloud-events","eventing","golang","ocm-w-stack"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclipse-xfsc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-10T13:24:53.000Z","updated_at":"2025-06-04T19:44:04.000Z","dependencies_parsed_at":"2025-04-20T18:20:45.976Z","dependency_job_id":"358f391a-c8c2-405f-bb74-6df0828808ba","html_url":"https://github.com/eclipse-xfsc/cloud-event-provider","commit_stats":null,"previous_names":["eclipse-xfsc/cloud-event-provider"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eclipse-xfsc/cloud-event-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-xfsc%2Fcloud-event-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-xfsc%2Fcloud-event-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-xfsc%2Fcloud-event-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-xfsc%2Fcloud-event-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclipse-xfsc","download_url":"https://codeload.github.com/eclipse-xfsc/cloud-event-provider/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-xfsc%2Fcloud-event-provider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33629560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-events","eventing","golang","ocm-w-stack"],"created_at":"2025-12-24T05:24:15.263Z","updated_at":"2026-05-28T22:31:30.267Z","avatar_url":"https://github.com/eclipse-xfsc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nThis library is used for abstracting messaging. The purpose of this library shall be to decapsulate message bus technologies from their usage. So it's doesnt matter if nats, kafka or anything else supported is used. \n\n\n# Usage\n\n## Get started\n\nAdd the module as dependency using go mod:\n\n`go get github.com/eclipse-xfsc/cloud-event-provider`\n\nAnd import the module in your code:\n\n```go\nimport \"github.com/eclipse-xfsc/cloud-event-provider\"\n```\n\n## Configure protocol and corresponding config with yaml File\n```yaml\nmessaging:\n  protocol: nats\n  nats:\n    url: http://localhost:4222\n    queueGroup: logger #optional\n    timeoutInSec: 10 #optional\n```\n\nEnvConfig can also be used by tagging the config: \n\n```go\nNats      cloudeventprovider.NatsConfig `envconfig:\"NATS\"`\n\n```\n\nAnd using ENVs like NATS_REQUEST_TIMEOUT (e.g. 10s), NATS_URL, NATS_QUEUE_GROUP\n\n## Send an Cloudevent\n```go\ntype message struct {\n    Receiver string `json:\"receiver\"`\n    Text string `json:\"text\"`\n}\n\nfunc main() {\n    topic := \"events\"\n    client, err := cloudeventprovider.New(cloudeventprovider.Config{\n\t\tProtocol: cloudeventprovider.ProtocolTypeNats,\n\t\tSettings: cloudeventprovider.NatsConfig{\n\t\t\tUrl:          config.Nats.Url,\n\t\t\tQueueGroup:   config.Nats.QueueGroup,\n\t\t\tTimeoutInSec: config.Nats.TimeoutInSec,\n\t\t},\n\t}, cloudeventprovider.Pub, retrieval.TopicRetrevialPublication)\n\n\tif err != nil {\n\t\treturn err\n\t}\n    defer c.Close()\n\n    pubMessage := message{\n        Receiver: \"Timo\",\n        Text:     \"Hello, my friend\",\n    }\n\n    data, err := json.Marshal(pubMessage)\n    if err != nil {\n        log.Fatal(err)\n    }\n    event, err := cloudeventprovider.NewEvent(\"event\", retrieval.EventTypeRetrievalReceivedNotification, b)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    if err := c.Pub(event); err != nil {\n        log.Fatalf(\"failed to send, %v\", err)\n    }\n}\n```\n\n## Receive an Cloudevent\n```go\nfunc StartMessageSubscription(log *logPkg.Logger) {\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tdefer wg.Done()\n\tlog.Info(\"start messaging!\")\n\n\tclient, err := cloudeventprovider.New(cloudeventprovider.Config{\n\t\tProtocol: cloudeventprovider.ProtocolTypeNats,\n\t\tSettings: cloudeventprovider.NatsConfig{\n\t\t\tUrl:          config.Nats.Url,\n\t\t\tQueueGroup:   config.Nats.QueueGroup,\n\t\t\tTimeoutInSec: config.Nats.TimeoutInSec,\n\t\t},\n\t}, cloudeventprovider.Sub, config.OfferingTopic)\n\tif err != nil {\n\t\tlog.Error(err, \"\")\n\t\tos.Exit(1)\n\t}\n\n\tdefer func() {\n\t\tif err := client.Close(); err != nil {\n\t\t\tlog.Error(err, \"error while closing client\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\n\terr = client.Sub(handleMessage)\n\tif err != nil {\n\t\tlog.Error(err, \"\")\n\t\tos.Exit(1)\n\t}\n\twg.Wait()\n}\n```\n## Supported protocols\n- Nats\n- NatsJetstream\n- Kafka\n- Http\n- Mqtt\n- Amqp\n\n## Trouble Shooting\n\nNats Timeout: If a nats time out error is arising during the sending of a message, check if the handler function was beforehand crashed by an fatal exception. In this case the responder is on the nats bus, but the handler is broken.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-xfsc%2Fcloud-event-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclipse-xfsc%2Fcloud-event-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-xfsc%2Fcloud-event-provider/lists"}