001package com.google.cloud.functions; 002 003import io.cloudevents.CloudEvent; 004 005/** 006 * Represents a Cloud Function that is activated by an event and parsed into a {@link CloudEvent} object. 007 */ 008@FunctionalInterface 009public interface CloudEventsFunction { 010 /** 011 * Called to service an incoming event. This interface is implemented by user code to 012 * provide the action for a given background function. If this method throws any exception 013 * (including any {@link Error}) then the HTTP response will have a 500 status code. 014 * 015 * @param event the event. 016 * @throws Exception to produce a 500 status code in the HTTP response. 017 */ 018 void accept(CloudEvent event) throws Exception; 019}