Class MessageReceiver
- java.lang.Object
-
- com.microsoft.azure.eventhubs.impl.MessageReceiver
-
- All Implemented Interfaces:
AmqpLink
,AmqpReceiver
public final class MessageReceiver extends Object implements AmqpReceiver
Common Receiver that abstracts all amqp related details translates event-driven reactor model into async receive Api
-
-
Field Summary
Fields Modifier and Type Field Description protected ScheduledExecutorService
executor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>
close()
void
closeSync()
static CompletableFuture<MessageReceiver>
create(MessagingFactory factory, String name, String recvPath, int prefetchCount, ReceiverSettingsProvider settingsProvider)
String
getClientId()
ErrorContext
getContext()
protected Exception
getLastKnownError()
long
getLastReceivedTime()
String
getReceivePath()
Duration
getReceiveTimeout()
protected CompletableFuture<Void>
onClose()
void
onClose(org.apache.qpid.proton.amqp.transport.ErrorCondition condition, String errorContext)
void
onError(Exception exception, String failingLinkName)
void
onOpenComplete(Exception exception)
void
onReceiveComplete(org.apache.qpid.proton.engine.Delivery delivery)
CompletableFuture<Collection<org.apache.qpid.proton.message.Message>>
receive(int maxMessageCount)
protected void
setClosed()
void
setReceiveTimeout(Duration value)
protected void
throwIfClosed()
-
-
-
Field Detail
-
executor
protected final ScheduledExecutorService executor
-
-
Method Detail
-
create
public static CompletableFuture<MessageReceiver> create(MessagingFactory factory, String name, String recvPath, int prefetchCount, ReceiverSettingsProvider settingsProvider)
-
getReceivePath
public String getReceivePath()
-
getReceiveTimeout
public Duration getReceiveTimeout()
-
setReceiveTimeout
public void setReceiveTimeout(Duration value)
-
receive
public CompletableFuture<Collection<org.apache.qpid.proton.message.Message>> receive(int maxMessageCount)
-
onOpenComplete
public void onOpenComplete(Exception exception)
- Specified by:
onOpenComplete
in interfaceAmqpLink
- Parameters:
exception
- completionException=null if open is successful
-
getLastReceivedTime
public long getLastReceivedTime()
-
onReceiveComplete
public void onReceiveComplete(org.apache.qpid.proton.engine.Delivery delivery)
- Specified by:
onReceiveComplete
in interfaceAmqpReceiver
-
onClose
public void onClose(org.apache.qpid.proton.amqp.transport.ErrorCondition condition, String errorContext)
-
getContext
public ErrorContext getContext()
-
onClose
protected CompletableFuture<Void> onClose()
-
getLastKnownError
protected Exception getLastKnownError()
-
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()
-
-