/** * Accept a {@link IMessageSession} in default {@link ReceiveMode#PEEKLOCK} mode asynchronously from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session. * * @param amqpConnectionStringBuilder the connection string builder * @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> acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId) { return acceptSessionFromConnectionStringBuilderAsync(amqpConnectionStringBuilder, sessionId, DEFAULTRECEIVEMODE); }
/** * Accept a {@link IMessageSession} from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session. * * @param amqpConnectionStringBuilder the connection string builder * @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 acceptSessionFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromConnectionStringBuilderAsync(amqpConnectionStringBuilder, sessionId, receiveMode)); }
/** * Accept a {@link IMessageSession} 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 * @param receiveMode {@link ReceiveMode} PeekLock or ReceiveAndDelete * @return a CompletableFuture representing the pending session accepting */ public static CompletableFuture<IMessageSession> acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId, ReceiveMode receiveMode) { Utils.assertNonNull("amqpConnectionString", amqpConnectionString); return acceptSessionFromConnectionStringBuilderAsync(new ConnectionStringBuilder(amqpConnectionString), sessionId, receiveMode); }