Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 3.47 KB

File metadata and controls

59 lines (39 loc) · 3.47 KB
description
This page provides the technical details of the Cloud Events policy

Cloud Events

Overview

You can use the cloud-events policy to create a cloud-events JSON object from messages. The datacontenttype will be set accordingly to the message Content-type if any.

This policy relies on the specification https://cloudevents.io and uses https://github.com/cloudevents/sdk-java library.

In APIM, you need to provide the cloud-events information in the policy configuration.

Functional and implementation information for the cloud-events policy is organized into the following sections:

Examples

{% hint style="warning" %} This policy can be applied to v4 message APIs. It cannot be applied to v2 APIs or v4 proxy APIs. {% endhint %}

{% tabs %} {% tab title="Message API example" %} Sample policy configuration:

{
    "cloud-events": {
        "type": "demo-events",
        "id": "{#message.metadata['key']}",
        "source": "kafka://{#message.metadata['topic']}/{#message.metadata['partition']}/{#message.metadata['offset']}"
    }
}

{% endtab %} {% endtabs %}

Configuration

Phases

The phases checked below are supported by the cloud-events policy:

v2 PhasesCompatible?v4 PhasesCompatible?
onRequestfalseonRequestfalse
onResponsefalseonResponsefalse
onRequestContentfalseonMessageRequesttrue
onResponseContentfalseonMessageResponsetrue

Options

You can configure the cloud-events policy with the following options:

PropertyRequiredDescriptionTypeDefault
idtrueThe id of the cloud-events object. See here. Can contain EL.string
typetrueThe type of the cloud-events object. See here. Can contain EL.string
sourcetrueThe source of the cloud-events object. See here. Can contain EL.string
subjectfalseThe subject of the cloud-events object. See here. Can contain EL.string

Errors

CodeError template keyDescription
500CLOUD_EVENTS_TRANSFORMATION_ERRORUnable to create cloud-events object