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} 007 * object. 008 */ 009@FunctionalInterface 010public interface CloudEventsFunction { 011 /** 012 * Called to service an incoming event. This interface is implemented by user code to provide the 013 * action for a given background function. If this method throws any exception (including any 014 * {@link Error}) then the HTTP response will have a 500 status code. 015 * 016 * @param event the event. 017 * @throws Exception to produce a 500 status code in the HTTP response. 018 */ 019 void accept(CloudEvent event) throws Exception; 020}