Reputation: 1913
Hi Could someone please explain to me what the Session ID in this connector is used for. And also why it is optional.
As i understand it this is used to close a message related to a sessionID?
Or does it close the whole session? ID it closes the session for all related messages in the Service bus queue?
Regards / John
Upvotes: 0
Views: 537
Reputation: 664
The purpose of session id is to maintain ordering between messages on a queue.
Suppose, there are multiple services that are dumping text from Harry Potter books at the same time, the sequence words sent by the services would be interleaved in the queue. Also, as soon as one of the service finishes reading one book, it goes on to start the next book that is not being read by the any other service. How would you identify that a given message is from a given book.
Here session id comes into play, as soon as a service starts reading a particular book, it will decide a new unique session id, and assign it to every word (i.e. the message it sends to the queue) that it reads it from that book. That way when your client reads the messages on the queue it can pick up one particular session id value and keep reading the messages which arrive with that session id. That way your client won't mix up the books and the sequence of reading the words will be maintained, even if the words on the queue are all mixed up from different books.
Also, the client which is reading messages with a particular session id, will have a lock on all the arrived (as well as those which will arrive in future) messages with that session id. So, other client won't read those messages. That is you can have multiple clients running in parallel, reading the text from different books without mixing up.
The Lock Token is the value that is used to complete the message.
Read this for more information: Message sessions: first in, first out (FIFO)
Upvotes: 1