Skip to main content

Process GRPC receiving

Initializes the stream, sends the request, and receives messages until closure or a set limit is reached

Function ProcessGRPCReceiving(Val Connection, Val Request, Val MessageCount = Undefined, Val Session = Undefined, Val Timeout = 10000) Export

ParameterCLI optionTypeRequiredDescription
Connection--connArbitraryExisting connection or connection parameters
Request--reqStructure Of KeyAndValueRequest data. See GetRequestSettings
MessageCount--amountNumberMaximum number of messages to receive, if necessary
Session--sessionStructure Of KeyAndValueSession settings. See GetSessionSettings
Timeout--toutNumberTimeout (in ms)
Returns

Map Of KeyAndValue - Processing result

1C:Enterprise/OneScript code example
URL = "http://localhost:9101";
Login = "bayselonarrend";
Password = "12we...";

Authorization = New Structure(Login, Password);
ConnectionSettings = OPI_ClickHouse.GetGRPCConnectionSettings(URL, Authorization);
Connection = OPI_ClickHouse.CreateGRPCConnection(ConnectionSettings);

SelectionText = "SELECT * FROM events_stream_test ORDER BY id";
Request = OPI_ClickHouse.GetRequestSettings(SelectionText, , , , "JSON");

Result = OPI_ClickHouse.ProcessGRPCReceiving(Connection, Request);
# JSON data can also be passed as a path to a .json file

oint clickhouse ProcessGRPCReceiving \
--conn "{'transport':'grpc','auth_type':'basic','user':'bayselonarrend','address':'http://127.0.0.1:9101','password':'***'}" \
--req "{'query':'SELECT * FROM events_stream_test ORDER BY id','format':'JSON'}"
Result
{
"stop_message": {
"error": "Closed",
"result": false
},
"result": true,
"messages": [
{
"message": {
"cancelled": false,
"exception": {
"code": 0,
"display_text": "",
"name": "",
"stack_trace": ""
},
"extremes": {
"BYTES": ""
},
"logs": [],
"output": {
"meta": [
{
"name": "id",
"type": "UInt64"
},
{
"name": "timestamp",
"type": "DateTime"
},
{
"name": "user_id",
"type": "UInt32"
},
{
"name": "event_type",
"type": "String"
},
{
"name": "payload",
"type": "String"
}
],
"data": [
{
"id": "1",
"timestamp": "2026-01-01 10:00:00",
"user_id": 100,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "1",
"timestamp": "2026-01-01 10:00:00",
"user_id": 100,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "1",
"timestamp": "2026-01-01 10:00:00",
"user_id": 100,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "1",
"timestamp": "2026-01-01 10:00:00",
"user_id": 100,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "2",
"timestamp": "2026-01-01 10:00:00",
"user_id": 101,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "2",
"timestamp": "2026-01-01 10:00:00",
"user_id": 101,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "2",
"timestamp": "2026-01-01 10:00:00",
"user_id": 101,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "2",
"timestamp": "2026-01-01 10:00:00",
"user_id": 101,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "3",
"timestamp": "2026-01-01 10:00:00",
"user_id": 102,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "3",
"timestamp": "2026-01-01 10:00:00",
"user_id": 102,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "3",
"timestamp": "2026-01-01 10:00:00",
"user_id": 102,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "3",
"timestamp": "2026-01-01 10:00:00",
"user_id": 102,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "4",
"timestamp": "2026-01-01 10:00:00",
"user_id": 103,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "4",
"timestamp": "2026-01-01 10:00:00",
"user_id": 103,
"event_type": "stream_test",
"payload": "{}"
},
{
"id": "4",
"timestamp": "2026-01-01 10:00:00",
"user_id": 103,
"event_type": "stream_test",
"payload": "{}"
},
{
...