All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.servicebus.BrowsableMessageSession Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.6.7
Show newest version
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

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.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) {
        super(messagingFactory, entityPath, 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 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> renewMessageLockBatchAsync(Collection messages) {
        throw new UnsupportedOperationException(INVALID_OPERATION_ERROR_MESSAGE);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy