/** * Accept a {@link IMessageSession} in default {@link ReceiveMode#PEEKLOCK} mode asynchronously from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session. * * @param amqpConnectionString the connection string * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @return a CompletableFuture representing the pending session accepting */ public static CompletableFuture<IMessageSession> acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId) { return acceptSessionFromConnectionStringAsync(amqpConnectionString, sessionId, DEFAULTRECEIVEMODE); }
/** * Accept a {@link IMessageSession} from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session. * * @param amqpConnectionString connection string * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param receiveMode {@link ReceiveMode} PeekLock or ReceiveAndDelete * @return {@link IMessageSession} instance * @throws InterruptedException if the current thread was interrupted while waiting * @throws ServiceBusException if the session cannot be accepted */ public static IMessageSession acceptSessionFromConnectionString(String amqpConnectionString, String sessionId, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromConnectionStringAsync(amqpConnectionString, sessionId, receiveMode)); }