com.microsoft.azure.servicebus.BrowsableMessageSession Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-servicebus Show documentation
Show all versions of azure-servicebus Show documentation
Java library for Azure Service Bus. Please note, a newer package com.azure:azure-messaging-servicebus for Azure Service Bus is available as of December 2020. While this package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Read the migration guide at https://aka.ms/azsdk/java/migrate/sb for more details.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.azure.servicebus;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import com.microsoft.azure.servicebus.primitives.MessagingEntityType;
import com.microsoft.azure.servicebus.primitives.MessagingFactory;
import com.microsoft.azure.servicebus.primitives.ServiceBusException;
/**
* A session object that can only be used to browse messages and state of a server side session. It cannot be used to receive messages from the service or to set state of the session.
*/
final class BrowsableMessageSession extends MessageSession {
private static final String INVALID_OPERATION_ERROR_MESSAGE = "Unsupported operation on a browse only session.";
BrowsableMessageSession(String sessionId, MessagingFactory messagingFactory, String entityPath, MessagingEntityType entityType) {
super(messagingFactory, entityPath, entityType, sessionId, ReceiveMode.PEEKLOCK);
// try {
// this.initializeAsync().get();
// } catch (InterruptedException | ExecutionException e) {
//
// }
}
@Override
protected boolean isBrowsableSession() {
return true;
}
@Override
public String getSessionId() {
return this.getRequestedSessionId();
}
@Override
public Instant getLockedUntilUtc() {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public int getPrefetchCount() {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public void setPrefetchCount(int prefetchCount) throws ServiceBusException {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture setStateAsync(byte[] sessionState) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture renewSessionLockAsync() {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public ReceiveMode getReceiveMode() {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture abandonAsync(UUID lockToken, Map propertiesToModify) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture completeAsync(UUID lockToken) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
// @Override
public CompletableFuture completeBatchAsync(Collection extends IMessage> messages) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture deferAsync(UUID lockToken, Map propertiesToModify) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture receiveAsync() {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture receiveAsync(Duration serverWaitTime) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture receiveDeferredMessageAsync(long sequenceNumber) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture> receiveBatchAsync(int maxMessageCount) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture> receiveBatchAsync(int maxMessageCount, Duration serverWaitTime) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture> receiveDeferredMessageBatchAsync(Collection sequenceNumbers) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture renewMessageLockAsync(IMessage message) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture renewMessageLockAsync(UUID lockToken) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
@Override
public CompletableFuture> renewMessageLockBatchAsync(Collection extends IMessage> messages) {
throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
}
}