benzene.gcp

Host Benzene handlers on Google Cloud Functions — HTTP + Pub/Sub triggers and a Pub/Sub outbound client. Distribution: benzene-gcp (depends on benzene-core, benzene-http).

pip install benzene-gcp            # add [pubsub] for the real outbound client

Overview

One host, two triggers, the same handlers behind both (transport-bindings §1):

GcpFunctionsApp

from benzene.gcp import GcpFunctionsApp, http_function, pubsub_function

app = GcpFunctionsApp(http_router=router, registry=registry)   # shares one pipeline across triggers

orders_http = http_function(app)         # entry point for @functions_framework.http
orders_pubsub = pubsub_function(app)     # entry point for @functions_framework.cloud_event

Pub/Sub binding

Testing

benzene.gcp.testing provides GcpFunctionsTestHost (send_http(...), send_pubsub(...)) plus HttpRequestBuilder / PubSubEventBuilder to drive both triggers in memory. See Hosting on Google Cloud Functions and the runnable examples/gcp_orders.

See also