---
title: "Session: How to Get the Current Session Node"
description: "Retrieve the cluster node that the current RavenDB session is sending requests to, useful for debugging topology and load balancing."
url: "https://docs.ravendb.net/7.2/client-api/session/how-to/get-current-session-node"
version: "7.2"
language: "java"
---

# Session: How to Get the Current Session Node

> Client language: Java. Also available for [C#](https://docs.ravendb.net/7.2/client-api/session/how-to/get-current-session-node.md), [PHP](https://docs.ravendb.net/7.2/client-api/session/how-to/get-current-session-node.php.md), [Node.js](https://docs.ravendb.net/7.2/client-api/session/how-to/get-current-session-node.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

When working in a RavenDB cluster, a database can reside on multiple nodes.  
When the client needs to send a request to the server, it can have several nodes to choose from.

The client uses [this logic](https://docs.ravendb.net/7.2/client-api/configuration/load-balance/overview.md#client-logic-for-choosing-a-node) to determine which node to send the request to.  
Learn more about load balancing the client requests in this [overview](https://docs.ravendb.net/7.2/client-api/configuration/load-balance/overview.md).

Use the `GetCurrentSessionNode` method  from the `Advanced` session operations  
to find out what is the current node that the session sends its requests to.

## Syntax

```java
ServerNode getCurrentSessionNode();
```

### Return Value

The return value of `getCurrentSessionNode` is a **ServerNode** object

```java
public class ServerNode {
  private String url;
  private String database;
  private String clusterTag;
  private Role serverRole;

  // getters and setters
}

public enum Role {
  NONE,
  PROMOTABLE,
  MEMBER,
  REHAB
}
```

## Example

```java
ServerNode serverNode = session.advanced().getCurrentSessionNode();
System.out.println(serverNode.getUrl());
```

## See also

- [How a Client Integrates with Replication and the Cluster](https://docs.ravendb.net/7.2/client-api/cluster/how-client-integrates-with-replication-and-cluster.java.md)
- [Cluster Node Health Check](https://docs.ravendb.net/7.2/client-api/cluster/health-check.md)
- [Overview](https://docs.ravendb.net/7.2/server/clustering/overview.md)
