I am working on an application where we are using Elastic to capture certain information about how data is being processed through the system. Here is a bit of psuedo code to give an idea of what is happening. In this code, "client" is a Nest client writing to Elastic.
var notes = List<Note>
.
.
.
notes.AddNote("data read in")
client.UpdateAsync(notes)
.
.
.
notes.AddNote("successfully enriched");
client.UpdateAsync(notes)
.
.
.
notes.AddNote("data written out");
client.UpdateAsync(notes)
The idea being at any time we could pull up the document to understand what has happened to a particular chunk of data.
I would like to use the UpdateAsync to avoid any hits on processing time waiting on Elastic. Does anyone know if the UpdateAsync will run those requests in order? Is the sequence of commands always like this?
first post... {"data read in"}
second post... {"data read in","successfully enriched"}
third post {"data read in","successfully enriched","data written out"}
I know that the call is async to me the calling program, but is it asynchronous under the hood? Or does Elastic handle them in sequence?
My chief concern is that the third post would not be the last post and the data would be lost.
The async calls are not being await
'ed meaning that the calls can happen concurrently here. If the calls are await
'ed then they'll happen in the order specified.
I know that the call is async to me the calling program, but is it asynchronous under the hood? Or does Elastic handle them in sequence?
The asynchronous code paths within the client are asynchronous. Certain elements are not asynchronous e.g. deserialization of the response which uses JSON.Net, that does not have an async deserialization implementation.