Send data to a gRPC endpoint with Azure IoT Data Processor Preview

Important

Azure IoT Operations Preview – enabled by Azure Arc is currently in PREVIEW. You shouldn't use this preview software in production environments.

See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Use the gRPC destination to write processed and clean data to a gRPC endpoint for further processing.

When you send data to a gRPC endpoint from a destination stage:

  • Currently, the stage only supports the Unary RPC type.
  • You can only use the Protobuf format. You must use the Protobuf with the gRPC call out stage.
  • Because this stage is a pipeline destination, the response is discarded.

Prerequisites

To configure and use a destination pipeline stage, you need:

  • A deployed instance of Azure IoT Data Processor Preview.
  • A gRPC server that's accessible from the Data Processor instance.
  • The protoc tool to generate the descriptor.

Configure the destination stage

The gRPC destination stage JSON configuration defines the details of the stage. To author the stage, you can either interact with the form-based UI, or provide the JSON configuration on the Advanced tab:

Name Type Description Required Default Example
Name string A name to show in the Data Processor UI. Yes - MLCall2
Description string A user-friendly description of the destination stage. No Call ML endpoint 2
Server address String The gRPC server address Yes - https://localhost:1313
RPC name string The RPC name to call Yes - GetInsights
Descriptor1 String The base 64 encoded descriptor Yes - CuIFChxnb29nb
Authentication string The authentication type to use. None/Metadata. Yes None None
Metadata key string The metadata key to use when Authentication is set to Metadata. No authorization authorization
Secret string The secret reference to use when Authentication is set to Metadata. No - mysecret
Retry Retry The retry policy to use. No default fixed
API request > Body path Path The path to the portion of the Data Processor message that should be serialized and set as the request body. Leave empty if you don't need to send a request body. No - .payload.gRPCRequest
API request > Metadata > Key2 Static/Dynamic field The metadata key to set in the request. No Static/Dynamic field
API request > Metadata > Value2 Static/Dynamic field The metadata value to set in the request. No Static/Dynamic field

1Descriptor: To serialize the request body, you need a base 64 encoded descriptor of the .proto file.

Use the following command to generate the descriptor, replace <proto-file> with the name of your .proto file:

protoc --descriptor_set_out=/dev/stdout --include_imports <proto-file> | base64 | tr '\n' ' ' | sed 's/[[:space:]]//g'

Use the output from the previous command as the descriptor in the configuration.

2API request > Metadata: Each element in the metadata array is a key value pair. You can set the key or value dynamically based on the content of the incoming message or as a static string.