/** * Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session. * @param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created. * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param receiveMode PeekLock or ReceiveAndDelete * @return a CompletableFuture representing the pending session accepting */ public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode) { return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, null, sessionId, receiveMode); }
/** * Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session. * @param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created. * @param entityPath path of entity * @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> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId) { return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, sessionId, DEFAULTRECEIVEMODE); }
/** * Asynchronously accepts a session in PeekLock mode from service bus using the client settings. Session Id can be null, if null, service will return the first available session. * @param namespaceName namespace of entity * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param clientSettings client settings * @return a CompletableFuture representing the pending session accepting */ public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings) { return acceptSessionFromEntityPathAsync(namespaceName, entityPath, sessionId, clientSettings, DEFAULTRECEIVEMODE); }
/** * Asynchronously accepts a session in PeekLock mode from service bus using the client settings. Session Id can be null, if null, service will return the first available session. * @param namespaceEndpointURI endpoint uri of entity namespace * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param clientSettings client settings * @return a CompletableFuture representing the pending session accepting */ public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings) { return acceptSessionFromEntityPathAsync(namespaceEndpointURI, entityPath, sessionId, clientSettings, DEFAULTRECEIVEMODE); }
/** * Accept a {@link IMessageSession} from service bus using the client settings with specified session id in PeekLock mode. Session Id can be null, if null, service will return the first available session. * @param namespaceEndpointURI endpoint uri of entity namespace * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param clientSettings client settings * @return IMessageSession instance * @throws InterruptedException if the current thread was interrupted while waiting * @throws ServiceBusException if the session cannot be accepted */ public static IMessageSession acceptSessionFromEntityPath(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromEntityPathAsync(namespaceEndpointURI, entityPath, sessionId, clientSettings)); }
/** * Accept a {@link IMessageSession} from service bus using the client settings with specified session id in PeekLock mode. Session Id can be null, if null, service will return the first available session. * @param namespaceName namespace of entity * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param clientSettings client settings * @return IMessageSession instance * @throws InterruptedException if the current thread was interrupted while waiting * @throws ServiceBusException if the session cannot be accepted */ public static IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromEntityPathAsync(namespaceName, entityPath, sessionId, clientSettings)); }
/** * Accept a {@link IMessageSession} from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session. * @param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created. * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param receiveMode PeekLock or ReceiveAndDelete * @return IMessageSession instance * @throws InterruptedException if the current thread was interrupted while waiting * @throws ServiceBusException if the session cannot be accepted */ public static IMessageSession acceptSessionFromEntityPath(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromEntityPathAsync(messagingFactory, entityPath, sessionId, receiveMode)); }
/** * Accept a {@link IMessageSession} from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session. * @param namespaceName namespace of entity * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param clientSettings client settings * @param receiveMode PeekLock or ReceiveAndDelete * @return IMessageSession instance * @throws InterruptedException if the current thread was interrupted while waiting * @throws ServiceBusException if the session cannot be accepted */ public static IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromEntityPathAsync(namespaceName, entityPath, sessionId, clientSettings, receiveMode)); }
/** * Accept a {@link IMessageSession} from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session. * @param namespaceEndpointURI endpoint uri of entity namespace * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param clientSettings client settings * @param receiveMode PeekLock or ReceiveAndDelete * @return IMessageSession instance * @throws InterruptedException if the current thread was interrupted while waiting * @throws ServiceBusException if the session cannot be accepted */ public static IMessageSession acceptSessionFromEntityPath(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromEntityPathAsync(namespaceEndpointURI, entityPath, sessionId, clientSettings, receiveMode)); }
/** * Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session. * @param namespaceName namespace of entity * @param entityPath path of entity * @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session * @param clientSettings client settings * @param receiveMode PeekLock or ReceiveAndDelete * @return a CompletableFuture representing the pending session accepting */ public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode) { Utils.assertNonNull("namespaceName", namespaceName); return acceptSessionFromEntityPathAsync(Util.convertNamespaceToEndPointURI(namespaceName),entityPath, sessionId, clientSettings, receiveMode); }
/** * Accept a {@link IMessageSession} 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 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 a CompletableFuture representing the pending session accepting */ public static CompletableFuture<IMessageSession> acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId, ReceiveMode receiveMode) { Utils.assertNonNull("amqpConnectionStringBuilder", amqpConnectionStringBuilder); return acceptSessionFromEntityPathAsync(amqpConnectionStringBuilder.getEndpoint(), amqpConnectionStringBuilder.getEntityPath(), sessionId, Util.getClientSettingsFromConnectionStringBuilder(amqpConnectionStringBuilder), receiveMode); }
private void acceptSessionAndPumpMessages() { if (!this.getIsClosingOrClosed()) { TRACE_LOGGER.debug("Accepting a session from entity '{}'", this.entityPath); CompletableFuture<IMessageSession> acceptSessionFuture = ClientFactory.acceptSessionFromEntityPathAsync(this.factory, this.entityPath, this.entityType, null, this.receiveMode); acceptSessionFuture.handleAsync((session, acceptSessionEx) -> { if (acceptSessionEx != null) {