Files
spring-cloud-function/spring-cloud-function-adapters/spring-cloud-function-grpc-cloudevent-ext
Oleg Zhurakousky 85a4fffcd4 GH-1172 Ensure content-type set in a message is honored on the output
Also, ensures that the proper content type is set in GCF FunctionInvoker

Resolves #1172
2024-09-09 12:51:36 +02:00
..

Spring Cloud Function gRPC extension to support CloudEvent proto.

This extension project designed as an extension to general Spring Cloud Function gRPC support to specifically suport CloudEvent proto

To use it simply import it as a dependency to your project together with

<dependency>
	<groupId>org.springframework.cloud</groupId>
	<artifactId>spring-cloud-function-grpc</artifactId>
</dependency>

Your project should also explicitly import CloudEvent proto and service proto

syntax = "proto3";

package io.cloudevents.v1;

import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "CloudEvent.proto";

service CloudEventService {
    rpc biStream(stream io.cloudevents.v1.CloudEvent) returns (stream io.cloudevents.v1.CloudEvent);
    
    rpc clientStream(stream io.cloudevents.v1.CloudEvent) returns (io.cloudevents.v1.CloudEvent);
    
    rpc serverStream(io.cloudevents.v1.CloudEvent) returns (stream io.cloudevents.v1.CloudEvent);
    
    rpc requestReply(io.cloudevents.v1.CloudEvent) returns (io.cloudevents.v1.CloudEvent);
}

Once done, you can send/receive CloudEvent messages

You can also reference this sample