title: How to register to receive service bus session messages that only have a particular session id?
body: <ol>
  <li>I am using .net core 3.1 and Microsoft.Azure.ServiceBus (version 5.1.3).</li>
  <li>I have a service bus topic with one subscription that can handle session messages only.</li>
  </ol>
  <p>A topic client can send 3 messages with session id (say ABCD) and then sends another 4 messages with session id (XYZ). It is pretty easy to write subscription client to receive all 7 messages with related session ids. However I want the ability to receive messages with session id XYZ only (and don't care about the messages with session id ABCD and don't even want to receive them).</p>
  <p>The following example code to receive all messages with all session ids works as expected:</p>
  <pre><code>static async Task Main(string[] args)
  {
      try
      {
          byte[] messageBody = System.Text.Encoding.Unicode.GetBytes(&quot;Hello, world!&quot;);
          ServiceBusConnectionStringBuilder builder = new ServiceBusConnectionStringBuilder(connectionString);
  
          SubscriptionClient client = new SubscriptionClient(builder, subscriptionName, ReceiveMode.PeekLock);
  
          var sessionHandler = new SessionHandlerOptions(ExceptionHandler);
          sessionHandler.AutoComplete = true;
          client.RegisterSessionHandler(SessionMessageHandler, sessionHandler);
  
          Console.WriteLine(&quot;Press any key to exit!&quot;);
          Console.ReadKey();
  
          await client.CloseAsync();
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex);
      }        
  }
  
  static Task SessionMessageHandler(IMessageSession session, Message message, CancellationToken cancellationToken)
  {
      var bodyText = System.Text.Encoding.Unicode.GetString(message.Body);
      Console.WriteLine($&quot;Session id: {message.SessionId}; Body: {bodyText}&quot;);
      return Task.CompletedTask;
  }
  
  static Task ExceptionHandler(ExceptionReceivedEventArgs args)
  {
      var context = args.ExceptionReceivedContext;
      Console.WriteLine($&quot;Exception context: {context.Action}, {context.ClientId}, {context.Endpoint}, {context.EntityPath}&quot;);
      Console.WriteLine($&quot;Exception: {args.Exception}&quot;);
      return Task.CompletedTask;
  }
  </code></pre>
  <p><strong>Questions:</strong></p>
  <ol>
  <li>How do I change the above code so that I only receive messages with session id XYZ only (without ever receiving the messages with session id ABCD)?</li>
  <li>If it is not possible with above code, is there any other way to achieve what I want (with the same library)? If so, please provide examples.</li>
  </ol>