Class MessagingFactory
- java.lang.Object
-
- com.microsoft.azure.eventhubs.impl.MessagingFactory
-
- All Implemented Interfaces:
AmqpConnection
,SessionProvider
public final class MessagingFactory extends Object implements AmqpConnection, SessionProvider
Abstracts all amqp related details and exposes AmqpConnection object Manages connection life-cycle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessagingFactory.MessagingFactoryBuilder
static class
MessagingFactory.ReactorFactory
-
Field Summary
Fields Modifier and Type Field Description static Duration
DefaultOperationTimeout
protected ScheduledExecutorService
executor
-
Method Summary
-
-
-
Field Detail
-
DefaultOperationTimeout
public static final Duration DefaultOperationTimeout
-
executor
protected final ScheduledExecutorService executor
-
-
Method Detail
-
createFromConnectionString
public static CompletableFuture<MessagingFactory> createFromConnectionString(String connectionString, ScheduledExecutorService executor) throws IOException
- Throws:
IOException
-
createFromConnectionString
public static CompletableFuture<MessagingFactory> createFromConnectionString(String connectionString, RetryPolicy retryPolicy, ScheduledExecutorService executor, ProxyConfiguration proxyConfiguration) throws IOException
- Throws:
IOException
-
createFromConnectionString
public static CompletableFuture<MessagingFactory> createFromConnectionString(String connectionString, RetryPolicy retryPolicy, ScheduledExecutorService executor, ProxyConfiguration proxyConfiguration, Duration watchdogTriggerTime) throws IOException
- Throws:
IOException
-
createFromConnectionString
public static CompletableFuture<MessagingFactory> createFromConnectionString(String connectionString, RetryPolicy retryPolicy, ScheduledExecutorService executor, MessagingFactory.ReactorFactory reactorFactory, ProxyConfiguration proxyConfiguration, Duration watchdogTriggerTime) throws IOException
- Throws:
IOException
-
registerForWatchdog
public void registerForWatchdog(MessageReceiver rcvr)
-
unregisterForWatchdog
public void unregisterForWatchdog(MessageReceiver rcvr)
-
getHostName
public String getHostName()
Description copied from interface:AmqpConnection
Host name intended to be used on Amqp Connection Open frame- Specified by:
getHostName
in interfaceAmqpConnection
- Returns:
- host name
-
getReactorDispatcher
public ReactorDispatcher getReactorDispatcher()
-
getTokenProvider
public ITokenProvider getTokenProvider()
-
getCBSChannel
public com.microsoft.azure.eventhubs.impl.CBSChannel getCBSChannel()
-
getManagementChannel
public com.microsoft.azure.eventhubs.impl.ManagementChannel getManagementChannel()
-
getSession
public org.apache.qpid.proton.engine.Session getSession(String path, Consumer<org.apache.qpid.proton.engine.Session> onRemoteSessionOpen, BiConsumer<org.apache.qpid.proton.amqp.transport.ErrorCondition,Exception> onRemoteSessionOpenError)
- Specified by:
getSession
in interfaceSessionProvider
-
getOperationTimeout
public Duration getOperationTimeout()
-
getRetryPolicy
public RetryPolicy getRetryPolicy()
-
onOpenComplete
public void onOpenComplete(Exception exception)
- Specified by:
onOpenComplete
in interfaceAmqpConnection
-
onConnectionError
public void onConnectionError(org.apache.qpid.proton.amqp.transport.ErrorCondition error)
- Specified by:
onConnectionError
in interfaceAmqpConnection
-
onClose
protected CompletableFuture<Void> onClose()
-
registerForConnectionError
public void registerForConnectionError(org.apache.qpid.proton.engine.Link link)
- Specified by:
registerForConnectionError
in interfaceAmqpConnection
-
deregisterForConnectionError
public void deregisterForConnectionError(org.apache.qpid.proton.engine.Link link)
- Specified by:
deregisterForConnectionError
in interfaceAmqpConnection
-
scheduleOnReactorThread
public void scheduleOnReactorThread(DispatchHandler handler) throws IOException, RejectedExecutionException
-
scheduleOnReactorThread
public void scheduleOnReactorThread(int delay, DispatchHandler handler) throws IOException, RejectedExecutionException
-
getClientId
public String getClientId()
-
setClosed
protected final void setClosed()
-
close
public final CompletableFuture<Void> close()
-
closeSync
public final void closeSync() throws EventHubException
- Throws:
EventHubException
-
throwIfClosed
protected final void throwIfClosed()
-
getLastKnownError
protected Exception getLastKnownError()
-
-