@srisa When your client calls the acceptSession
method then all the messages that will be sent using this session will only be consumed by that client.
Let's say if you don't have any message in the queue and the client called acceptSession("greetings-id")
then your client will keep on waiting for the new messages that will be sent with the session id greetings-id.
In case if there is no message with that session ID then there will be no expected message raised as it waits for the messages for that session id. Once your client found a new message (with greetings-id) it will hold the lock and consume that message.
The same is covered on service bus session document.
A session receiver is created by a client accepting a session. When the session is accepted and held by a client, the client holds an exclusive lock on all messages with that session's session ID in the queue or subscription. It will also hold exclusive locks on all messages with the session ID that will arrive later.
Feel free to get back to me if you have any queries or concerns.