{"id":22381973,"url":"https://github.com/googleinterns/cloudevents-sdk-cpp","last_synced_at":"2026-04-03T10:32:37.655Z","repository":{"id":39253843,"uuid":"271611888","full_name":"googleinterns/cloudevents-sdk-cpp","owner":"googleinterns","description":"C++ SDK for CloudEvents","archived":false,"fork":false,"pushed_at":"2020-09-07T20:22:52.000Z","size":170,"stargazers_count":4,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-12-17T09:33:48.013Z","etag":null,"topics":["cloudevents"],"latest_commit_sha":null,"homepage":"","language":"C++","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/googleinterns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-11T17:52:43.000Z","updated_at":"2023-10-18T01:36:39.000Z","dependencies_parsed_at":"2022-09-10T01:00:57.738Z","dependency_job_id":null,"html_url":"https://github.com/googleinterns/cloudevents-sdk-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fcloudevents-sdk-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fcloudevents-sdk-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fcloudevents-sdk-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fcloudevents-sdk-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googleinterns","download_url":"https://codeload.github.com/googleinterns/cloudevents-sdk-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228209948,"owners_count":17885595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cloudevents"],"created_at":"2024-12-05T00:11:18.753Z","updated_at":"2026-04-03T10:32:37.593Z","avatar_url":"https://github.com/googleinterns.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/googleinterns/cloudevents-sdk-cpp.svg?branch=master)](https://travis-ci.org/googleinterns/cloudevents-sdk-cpp)\n\n# C++ SDK for [CloudEvents](https://github.com/cloudevents/spec)\n\nThis SDK is still a work in progress.\n\nThe CloudEvent class (generated from protobuf) is based on this [open PR to the CloudEvent spec](https://github.com/JemDay/spec/tree/jd-proto) from JemDay.\n\u003cbr/\u003e\n\nThe PubsubMessage class (generated from protobuf) is based on [Google API](https://github.com/googleapis/googleapis/blob/master/google/pubsub/v1/pubsub.proto#L188).\n\n**This is not an officially supported Google product.**\n\n# User Guide\nMore example use cases are available in header files as comments.\nThe only files that you will directly import and use are in `//v1/protocol_binding/`.\n\n## Setup\n### Install Bazel Build System\nInstuctions found in [Bazel documentation](https://docs.bazel.build/versions/master/install-ubuntu.html).\n\n### Import SDK as a Bazel package in WORKSPACE\nIn `//WORKSPACE`\n```\n# TODO (#63) : Update README to create Bazel target to master repo once merged\n\ngit_repository(\n    name = \"cloudevents_cpp_sdk\",\n    commit = \"20c9855c11bc66efcc6e086571477bb69870be1d\",\n    remote = \"https://github.com/michlee1337/cloudevents-sdk-cpp/tree/binder-all.v2\",\n)\n\n```\n\n### Set up the build dependencies\nSpecify any binders needed as a bazel target dependency.\n\nTo use PubsubBinder:\n```\ncc_binary(\n    ...\n    deps = [\n        ...\n        \"@cloudevents_cpp_sdk/protocol_binding:pubsub_binder_lib\",\n    ],\n)\n```\n\nTo use HttpReqBinder or HttpResBinder:\n```\ncc_binary(\n    ...\n    deps = [\n        ...\n        \"@cloudevents_cpp_sdk/protocol_binding:http_binder_lib\",\n    ],\n)\n```\n\n## Binding a CloudEvent to a Protocol-Message in Binary-ContentMode\nImport the header file and use XBinder\n```\n// import the header for the binder\n#include \"//v1/protocol_binding/pubsub_binder.h\"\n\nusing ::google::pubsub::v1::PubsubMessage;\nusing ::cloudevents::binder::PubsubBinder;\nusing ::cloudevents_absl::StatusOr;\n\n// create a CloudEvent\nCloudEvent my_cloud_event;\nmy_cloud_event.set_id(\"my_id\");\nmy_cloud_event.set_source(\"my_source\");\nmy_cloud_event.set_spec_version(\"1.0\");\nmy_cloud_event.set_type(\"my_type\");\nmy_cloud_event.set_binary_data(\"1010\");\n\n// Initialize the binder\nPubsubBinder pubsub_binder;\n\n// Create the Message\nStatusOr\u003cPubsubMessage\u003e bind = pubsub_binder.Bind(my_cloud_event);\n\n// Check no errors\nif (!bind.ok()) {\n  std::cerr \u003c\u003c bind.status();\n}\n\n// unwrap message\nPubsubMessage usable_message = *bind;\n```\n\n## Binding a CloudEvent to a Protocol-Message in Structured-ContentMode\nImport the header file and use Format and XBinder\n```\n// import the header for the binder\n#include \"//v1/protocol_binding/pubsub_binder.h\"\n\nusing ::google::pubsub::v1::PubsubMessage;\nusing ::cloudevents::binder::PubsubBinder\nusing ::cloudevents::format::Format\nusing ::cloudevents_absl::StatusOr;\n\n// create a CloudEvent\nCloudEvent my_cloud_event;\nmy_cloud_event.set_id(\"my_id\");\nmy_cloud_event.set_source(\"my_source\");\nmy_cloud_event.set_spec_version(\"1.0\");\nmy_cloud_event.set_type(\"my_type\");\nmy_cloud_event.set_binary_data(\"1010\");\n\n// initialize the binder\nPubsubBinder pubsub_binder;\n\n// specify the EventFormat to be used and create the Message\nStatusOr\u003cPubsubMessage\u003e bind = pubsub_binder.Bind(my_cloud_event, Format::kJson);\n\n// check no errors\nif (!bind.ok()) {\n  std::cerr \u003c\u003c bind.status();\n}\n\n// unwrap message\nPubsubMessage usable_message = *bind;\n```\n\n## Unbind a CloudEvent from a Protocol-Message\n```\n// import the header for the binder of the protocol message you're working with\n#include \"//v1/protocol_binding/pubsub_binder.h\"\n\nusing ::google::pubsub::v1::PubsubMessage;\nusing ::cloudevents::binder::Binder\nusing ::cloudevents_absl::StatusOr;\n\nPubsubMessage my_pusub_msg = ...; // However you get this message\n\n// initialize the binder\nPubsubBinder pubsub_binder;\n\n// create the CloudEvent\nStatusOr\u003cCloudEvent\u003e unbind = pubsub_binder.Unbind(my_pusub_msg);\n\n// check no errors\nif (!unbind.ok()) {\n  std::cerr \u003c\u003c unbind.status();\n}\n\n// unwrap cloudevent\nCloudEvent cloud_event = *unbind;\n\n```\n\n# Samples\nRun-able code samples are available in the `/samples` folder.\n\n### Run\n1. Create executable \u003cbr/\u003e\n`bazel build //sample:create_event`\n2. Run executable \u003cbr/\u003e\n`bazel-bin/sample/create_event`\n\n# File Structure\nAll logic related to implementing version 1 of the CloudEvent spec can be found in `//v1`.\n- All logic for [Protocol Binding](https://github.com/cloudevents/spec/blob/master/spec.md#protocol-binding)s can be found in the subfolder `//v1/protocol_binding`.\n- All logic for [Event Format](https://github.com/cloudevents/spec/blob/master/spec.md#event-format)s can be found in the subfolder `//v1/event_format`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleinterns%2Fcloudevents-sdk-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogleinterns%2Fcloudevents-sdk-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleinterns%2Fcloudevents-sdk-cpp/lists"}