How to consume gRPC services with SAP PO.
When consuming grpc services, SAP PO acts like gRPC a client application calling methods on a server application on a different machine. The server application can be a internal developed microservice or a cloud service like Google Pub/Sub.
With gRPC, a service is defined with methods that can be called remotely with their parameters and return types. The gRPC server implements the interface and processes client calls. On the client side, in this case, SAP PO, the client has a stub (referred to as just a client in some languages) that provides the same methods as the service on the gRPC server.
Most gRPC services use protocol buffers, Google’s mature open source mechanism for serializing structured data.
gRPC leverages HTTP/2 underneath and as such benefits from many of the efficiencies of HTTP/2.
Scenario: Pull/Publish messages to GCP PubSub using the gRPC API.
We describe below a use case of consuming Google Cloud Pub/Sub service using the gRPC api. We show how to use the Advantco gRPC adapter to pull data out of a Pub/Sub topic and how to publish data to a Pub/Sub topic.
Prepare the proto files
Get the pubsub.proto file at https://github.com/googleapis/googleapis/tree/master/google/pubsub/v1
Make sure you download also the other proto definitions used by the pubsub.proto file.
The services and methods available are defined in the pubsub.proto file.
Sender channel configuration
To pull a message from a GCP topic, we have to use the Subscriber service. In the Input Parameters, we specify the project and subscription.
Receiver channel configuration
Here we configure the receiver channel to publish a message to a GCP Pub/Sub topic.
Payload structure to publish message to a Pub/Sub topic using gRPC.
This message structure is specific for GCP Pub/Sub service.
<PublishRequest> <topic>projects/usdemo-198922/topics/US_GRPC</topic> <messages> <data>Message sent using Advantco gRPC Adapter</data> <attributes> <Entry_Map_Element> <key>attribute_1</key> <value>value_of_attribute_1</value> </Entry_Map_Element> <Entry_Map_Element> <key>attribute_2</key> <value>value_of_attribute_2</value> </Entry_Map_Element> </attributes> <message_id>02102019</message_id> </messages> </PublishRequest>
Consuming gRPC services with SAP PO is now possible with the Advantco gRPC adapter, this open new possibilities to integration with microservices thru the gRPC protocols.
This is the main site for all gRPC information: https://www.grpc.io/
GCP Pub/Sub API: https://cloud.google.com/pubsub/docs/reference/rpc/
I liked your Post. this is something really great and nice. dgcustomerfirst