MessageSession Class
- java.
lang. Object - ClientEntity
- com.
microsoft. azure. servicebus. InitializableEntity - com.
microsoft. azure. servicebus. MessageReceiver - com.
microsoft. azure. servicebus. MessageSession
- com.
- com.
- com.
public class MessageSession implements IMessageSession
Method Summary
Modifier and Type | Method and Description |
---|---|
Instant | getLockedUntilUtc() |
String | getRequestedSessionId() |
String | getSessionId() |
byte [] |
getState()
Gets the session state. |
CompletableFuture<byte[]> |
getStateAsync()
Asynchronously gets the session state. |
boolean | isBrowsableSession() |
final boolean | isSessionReceiver() |
void |
renewSessionLock()
Renews the lock on the session specified by the getSessionId(). The lock will be renewed based on the setting specified on the entity. When you accept a session, the session is locked for this client instance by the service for a duration as specified during the Queue/Subscription creation. If processing of the session requires longer than this duration, the session-lock needs to be renewed. For each renewal, the session-lock is renewed by the entity's LockDuration. Renewal of session renews all the messages in the session as well. Each individual message need not be renewed. |
CompletableFuture<Void> |
renewSessionLockAsync()
Renews the lock on the session specified by the getSessionId(). The lock will be renewed based on the setting specified on the entity. |
void |
setState(byte[] sessionState)
Set a custom state on the session which can be later retrieved using getState(). |
CompletableFuture<Void> |
setStateAsync(byte[] sessionState)
Asynchronously set a custom state on the session which can be later retrieved using getState(). |
Inherited Members
Method Details
getLockedUntilUtc
public Instant getLockedUntilUtc()
Overrides:
MessageSession.getLockedUntilUtc()Returns:
getRequestedSessionId
protected String getRequestedSessionId()
getSessionId
public String getSessionId()
Overrides:
MessageSession.getSessionId()Returns:
getState
public byte [] getState()
Gets the session state.
Overrides:
MessageSession.getState()Returns:
Throws:
getStateAsync
public CompletableFuture
Asynchronously gets the session state.
Overrides:
MessageSession.getStateAsync()Returns:
isBrowsableSession
protected boolean isBrowsableSession()
isSessionReceiver
protected final boolean isSessionReceiver()
renewSessionLock
public void renewSessionLock()
Renews the lock on the session specified by the getSessionId(). The lock will be renewed based on the setting specified on the entity.
When you accept a session, the session is locked for this client instance by the service for a duration as specified during the Queue/Subscription creation. If processing of the session requires longer than this duration, the session-lock needs to be renewed. For each renewal, the session-lock is renewed by the entity's LockDuration.
Renewal of session renews all the messages in the session as well. Each individual message need not be renewed.
Overrides:
MessageSession.renewSessionLock()Throws:
renewSessionLockAsync
public CompletableFuture
Renews the lock on the session specified by the getSessionId(). The lock will be renewed based on the setting specified on the entity.
Overrides:
MessageSession.renewSessionLockAsync()Returns:
setState
public void setState(byte[] sessionState)
Set a custom state on the session which can be later retrieved using getState().
Overrides:
MessageSession.setState(byte[] sessionState)Parameters:
Throws:
setStateAsync
public CompletableFuture
Asynchronously set a custom state on the session which can be later retrieved using getState().
Overrides:
MessageSession.setStateAsync(byte[] sessionState)Parameters:
Returns:
Applies to
Azure SDK for Java