Files
spring-cloud-function/spring-cloud-function-adapters/spring-cloud-function-grpc-cloudevent-ext
2022-09-03 23:17:35 +00:00
..
2021-10-18 17:55:33 +02:00
2022-09-03 23:17:35 +00: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