Package com.azure.core.amqp
Interface AmqpSession
-
- All Superinterfaces:
AsyncCloseable,Disposable
public interface AmqpSession extends Disposable, AsyncCloseable
An AMQP session representing bidirectional communication that supports multipleAMQP links.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface reactor.core.Disposable
Disposable.Composite, Disposable.Swap
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Mono<Void>closeAsync()Mono<Void>commitTransaction(AmqpTransaction transaction)Commit the transaction on the message broker.Mono<AmqpLink>createConsumer(String linkName, String entityPath, Duration timeout, AmqpRetryPolicy retryPolicy)Creates a new AMQP link that consumes events from the message broker.Mono<AmqpLink>createProducer(String linkName, String entityPath, Duration timeout, AmqpRetryPolicy retryPolicy)Creates a new AMQP link that publishes events to the message broker.Mono<AmqpTransaction>createTransaction()Creates the transaction on the message broker.Flux<AmqpEndpointState>getEndpointStates()Gets the endpoint states for the AMQP session.DurationgetOperationTimeout()Gets the operation timeout for starting the AMQP session.default Mono<? extends AmqpTransactionCoordinator>getOrCreateTransactionCoordinator()Gets an existing or newly createdAmqpTransactionCoordinatoron theAmqpSessionwhich maintains one instance of theAmqpTransactionCoordinatorobject.StringgetSessionName()Gets the name for this AMQP session.booleanremoveLink(String linkName)Removes anAmqpLinkwith the givenlinkName.Mono<Void>rollbackTransaction(AmqpTransaction transaction)Rollback the transaction on the message broker.-
Methods inherited from interface reactor.core.Disposable
dispose, isDisposed
-
-
-
-
Method Detail
-
getSessionName
String getSessionName()
Gets the name for this AMQP session.- Returns:
- The name for the AMQP session.
-
getOperationTimeout
Duration getOperationTimeout()
Gets the operation timeout for starting the AMQP session.- Returns:
- The timeout for starting the AMQP session.
-
createProducer
Mono<AmqpLink> createProducer(String linkName, String entityPath, Duration timeout, AmqpRetryPolicy retryPolicy)
Creates a new AMQP link that publishes events to the message broker.- Parameters:
linkName- Name of the link.entityPath- The entity path this link connects to when producing events.timeout- Timeout required for creating and opening AMQP link.retryPolicy- The retry policy to use when sending messages.- Returns:
- A newly created AMQP link.
-
createConsumer
Mono<AmqpLink> createConsumer(String linkName, String entityPath, Duration timeout, AmqpRetryPolicy retryPolicy)
Creates a new AMQP link that consumes events from the message broker.- Parameters:
linkName- Name of the link.entityPath- The entity path this link connects to, so that it may read events from the message broker.timeout- Timeout required for creating and opening an AMQP link.retryPolicy- The retry policy to use when consuming messages.- Returns:
- A newly created AMQP link.
-
removeLink
boolean removeLink(String linkName)
Removes anAmqpLinkwith the givenlinkName.- Parameters:
linkName- Name of the link to remove.- Returns:
trueif the link was removed;falseotherwise.
-
getEndpointStates
Flux<AmqpEndpointState> getEndpointStates()
Gets the endpoint states for the AMQP session.AmqpExceptionsthat occur on the link are reported in the connection state. When the stream terminates, the session is closed.- Returns:
- A stream of endpoint states for the AMQP session.
-
createTransaction
Mono<AmqpTransaction> createTransaction()
Creates the transaction on the message broker.- Returns:
- A newly created AMQPTransaction.
-
commitTransaction
Mono<Void> commitTransaction(AmqpTransaction transaction)
Commit the transaction on the message broker.- Parameters:
transaction- to commit.- Returns:
- A completable mono.
-
rollbackTransaction
Mono<Void> rollbackTransaction(AmqpTransaction transaction)
Rollback the transaction on the message broker.- Parameters:
transaction- to rollback- Returns:
- A completable mono.
-
getOrCreateTransactionCoordinator
default Mono<? extends AmqpTransactionCoordinator> getOrCreateTransactionCoordinator()
Gets an existing or newly createdAmqpTransactionCoordinatoron theAmqpSessionwhich maintains one instance of theAmqpTransactionCoordinatorobject. TheAmqpTransactionCoordinatoris used to create/commit or rollback the transaction which can span over one or more message broker entities. The interfaceAmqpSessionprovides default implementation for back-word compatibility but it throwsRuntimeExceptionto warn that an implementing class must override and provide implementation of this API. Azure SDK already provides implementation for this API.- Returns:
- An existing or if it does not exists newly created
AmqpTransactionCoordinator. - Throws:
UnsupportedOperationException- Indicting implementation not found error. Azure SDK should provide implementation of this API but if runtime is not able to find it in its classpath or version mismatch can cause this exception.- See Also:
- Transaction Coordination
-
closeAsync
default Mono<Void> closeAsync()
- Specified by:
closeAsyncin interfaceAsyncCloseable
-
-