private static async Task TarantoolTester(List <MessageData> messages) { var dataAccess = new TarantoolDataAccess(JsonServiceFactory.GetSerializer("newtonsoft")); // for (var i = 0; i < messages.Count; i++) // { // var message = messages[i]; // // var id = await dataAccess.Add(message, CancellationToken.None); // // var savedObject = await dataAccess.Get(id, CancellationToken.None); // //// await dataAccess.Delete(id, CancellationToken.None); // } var list = await dataAccess.GetAll(-1L, CancellationToken.None); foreach (var messageData in list) { await dataAccess.Delete(messageData.Id, CancellationToken.None); } // WriteLine(list.Count); GetMeasurementsResult().ForEach(WriteLine); }
private static async Task KafkaTester(List <MessageData> messages) { var dataAccess = new KafkaDataAccess(JsonServiceFactory.GetSerializer("newtonsoft")); var list = await dataAccess.GetAll(Unit.Value, CancellationToken.None); WriteLine(list.Count); for (var i = 0; i < messages.Count; i++) { var message = messages[i]; await dataAccess.Add(message, CancellationToken.None); // var savedObject = await dataAccess.Get(dataObj.Data.Id, CancellationToken.None); // await dataAccess.Delete(dataObj.Data.Id, CancellationToken.None); } var batch = await dataAccess.GetBatch(100, CancellationToken.None); GetMeasurementsResult().ForEach(WriteLine); }
private IScript CreateScript(string name, string jsonSerializerName, ScriptConfig config) { switch (name) { case "aerospike": var aerospike = new AerospikeDataAccess(new Utf8JsonBinaryWrapper()); return(new AerospikeSimpleWriteRead(aerospike, config)); case "postgres": var postgres = new PostgresDataAccess(); return(new PostgresSimpleWriteReadScript(postgres, config)); case "kafka": var kafka = new KafkaDataAccess(JsonServiceFactory.GetSerializer(jsonSerializerName ?? "newtonsoft")); return(new KafkaSimpleWriteRead(kafka, config)); case "tarantool": var tarantool = new TarantoolDataAccess(JsonServiceFactory.GetSerializer(jsonSerializerName ?? "newtonsoft")); return(new TarantoolSimpleWriteRead(tarantool, config)); default: throw new NotSupportedException(); } }