Skip to main content

Process client stream

Initializes client thread, passes message array, and receives final response

Function ProcessClientStream(Val Connection, Val Service, Val Method, Val Requests, Val Timeout = 10000, Val Tls = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Connection--connArbitraryExisting connection or connection parameters
Service--serviceStringService name
Method--methodStringMethod name
Requests--dataArray of StructureRequest data array or single request
Timeout--toutNumberTimeout for individual operation (in ms))
Tls--tlsStructure Of KeyAndValueTLS settings, if necessary. See GetTlsSettings

Returns: Map Of KeyAndValue - Processing result

1C:Enterprise/OneScript code example
    Address = "https://grpcb.in:9001";

Proto1 = "https://hut.openintegrations.dev/test_data/grpcbin_with_import.proto"; // String, path to file or URL
Proto2 = "https://hut.openintegrations.dev/test_data/mt.proto"; // String, path to file or URL

Scheme = New Map;
Scheme.Insert("main.proto" , Proto1); // Primary
Scheme.Insert("my_types.proto", Proto2); // For import in primary

Parameters = OPI_GRPC.GetConnectionParameters(Address, Scheme);
Tls = OPI_GRPC.GetTlsSettings(True);

Service = "grpcbin.GRPCBin";
Method = "DummyClientStream";

Data = New Map;
Data.Insert("f_string" , "Test message");
Data.Insert("f_int32" , 123);
Data.Insert("f_bool" , True);
Data.Insert("f_sub" , New Structure("f_string", "Nested value"));

ArrayOfRequests = New Array;

For N = 1 To 10 Do
ArrayOfRequests.Add(Data);
EndDo;

Result = OPI_GRPC.ProcessClientStream(Parameters, Service, Method, ArrayOfRequests, , Tls);
    # JSON data can also be passed as a path to a .json file

oint grpc ProcessClientStream \
--conn "{'address':'https://grpcb.in:9001','proto':{'main.proto':'https://hut.openintegrations.dev/test_data/grpcbin_with_import.proto','my_types.proto':'https://hut.openintegrations.dev/test_data/mt.proto'}}" \
--service "grpcbin.GRPCBin" \
--method "DummyClientStream" \
--data "[{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}},{'f_string':'Test message','f_int32':'123','f_bool':true,'f_sub':{'f_string':'Nested value'}}]" \
--tls "{'use_tls':true,'accept_invalid_certs':true}"
Result
{
"message": {
"f_bool": true,
"f_bools": [],
"f_bytes": {
"BYTES": ""
},
"f_bytess": [],
"f_enum": "ENUM_0",
"f_enums": [],
"f_float": 0,
"f_floats": [],
"f_int32": 123,
"f_int32s": [],
"f_int64": 0,
"f_int64s": [],
"f_string": "Test message",
"f_strings": [],
"f_sub": {
"f_string": "Nested value"
},
"f_subs": []
},
"result": true,
"messages_sent": 10,
"finish_sending": {
"result": true
}
}