-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connects proton-j to service and contacts CBS node for authorization (#…
…3795) Remove types that are no longer needed Moving EventDataUtil into EventData. Add ability to deserialize AMQP message into EventData Adding AmqpException for EventDataBatch Update ReactorDispatcher to use friendly ways of fetching work. Add AmqpConnection, AmqpSession, AmqpLink, ConnectionState, Add ConnectionHandler, CustomIOHandler, DispatchHandler Add initial way to create a connection and reactor into EventHubClient Update Sender test with correct exception and add initial EventHubClientTest ReactorFactory: Add ability to createConnection. Add ReactorExecutor which is responsible for looping and processing reactor work. Add ReactorProvider and ReactorHandlerProvider that will handle creation of the Reactor instances and handlers. Adding AmqpShutdownSignal, and AmqpEndpointStateNotifierBase for state changes. Adding Track 2 SDK to pom.client.xml
- Loading branch information
Showing
57 changed files
with
3,309 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
eventhubs/client/azure-eventhubs/src/main/java/com/azure/core/amqp/AmqpConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.core.amqp; | ||
|
||
import reactor.core.publisher.Mono; | ||
|
||
import java.io.Closeable; | ||
import java.util.Map; | ||
|
||
/** | ||
* Represents a TCP connection between the client and a service that uses the AMQP protocol. | ||
*/ | ||
public interface AmqpConnection extends EndpointStateNotifier, Closeable { | ||
/** | ||
* Gets the connection identifier. | ||
* | ||
* @return The connection identifier. | ||
*/ | ||
String getIdentifier(); | ||
|
||
/** | ||
* Gets the host for the AMQP connection. | ||
* | ||
* @return The host for the AMQP connection. | ||
*/ | ||
String getHost(); | ||
|
||
/** | ||
* Gets the maximum framesize for the connection. | ||
* | ||
* @return The maximum frame size for the connection. | ||
*/ | ||
int getMaxFrameSize(); | ||
|
||
/** | ||
* Gets the connection properties. | ||
* | ||
* @return Properties associated with this connection. | ||
*/ | ||
Map<String, Object> getConnectionProperties(); | ||
|
||
/** | ||
* Gets the claims-based security (CBS) node that authorizes access to resources. | ||
* | ||
* @return Provider that authorizes access to AMQP resources. | ||
*/ | ||
Mono<CBSNode> getCBSNode(); | ||
|
||
/** | ||
* Creates a new session with the given entity path. | ||
* | ||
* @param sessionName Name of the session. | ||
* @return The AMQP session that was created. | ||
*/ | ||
Mono<AmqpSession> createSession(String sessionName); | ||
|
||
/** | ||
* Removes a session with the {@code sessionName} from the AMQP connection. | ||
* | ||
* @param sessionName Name of the session to remove. | ||
* @return {@code true} if a session with the name was removed; {@code false} otherwise. | ||
*/ | ||
boolean removeSession(String sessionName); | ||
} |
22 changes: 22 additions & 0 deletions
22
eventhubs/client/azure-eventhubs/src/main/java/com/azure/core/amqp/AmqpEndpointState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.core.amqp; | ||
|
||
/** | ||
* Represents a state for a connection, session, or link. | ||
*/ | ||
public enum AmqpEndpointState { | ||
/** | ||
* The endpoint has not been initialized. | ||
*/ | ||
UNINITIALIZED, | ||
/** | ||
* The endpoint is active. | ||
*/ | ||
ACTIVE, | ||
/** | ||
* The endpoint is closed. | ||
*/ | ||
CLOSED | ||
} |
60 changes: 60 additions & 0 deletions
60
eventhubs/client/azure-eventhubs/src/main/java/com/azure/core/amqp/AmqpExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.core.amqp; | ||
|
||
import com.azure.core.amqp.exception.ErrorContext; | ||
import com.azure.core.implementation.logging.ServiceLogger; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Handles exceptions generated by AMQP connections, sessions, and/or links. | ||
*/ | ||
public abstract class AmqpExceptionHandler { | ||
private final ServiceLogger logger; | ||
|
||
/** | ||
* Creates a new instance of an exception handler. | ||
*/ | ||
protected AmqpExceptionHandler() { | ||
this.logger = new ServiceLogger(AmqpExceptionHandler.class); | ||
} | ||
|
||
/** | ||
* Creates the exception handler with the provided logger. | ||
* | ||
* @param logger Logger to use when issuing logs. | ||
*/ | ||
protected AmqpExceptionHandler(ServiceLogger logger) { | ||
Objects.requireNonNull(logger); | ||
this.logger = logger; | ||
} | ||
|
||
/** | ||
* Notifies the exception handler of an endpoint error. | ||
* | ||
* @param context The error context that caused the error. | ||
*/ | ||
public void onConnectionError(ErrorContext context) { | ||
logger.asWarning().log("Connection error: {}", context); | ||
} | ||
|
||
/** | ||
* Notifies the exception handler of an exception. | ||
* | ||
* @param exception The exception that caused the connection error. | ||
*/ | ||
public void onConnectionError(Throwable exception) { | ||
logger.asWarning().log("Connection exception encountered: {}", exception); | ||
} | ||
|
||
/** | ||
* Notifies the exception handler that a shutdown signal occurred. | ||
* | ||
* @param shutdownSignal The shutdown signal that was received. | ||
*/ | ||
public void onConnectionShutdown(AmqpShutdownSignal shutdownSignal) { | ||
logger.asInformational().log("Shutdown received: {}", shutdownSignal); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
eventhubs/client/azure-eventhubs/src/main/java/com/azure/core/amqp/AmqpLink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.core.amqp; | ||
|
||
import java.io.Closeable; | ||
|
||
/** | ||
* Represents a unidirectional AMQP link. | ||
*/ | ||
public interface AmqpLink extends Closeable { | ||
/** | ||
* Gets the name of the link. | ||
* | ||
* @return The name of the link. | ||
*/ | ||
String getLinkName(); | ||
} |
54 changes: 54 additions & 0 deletions
54
eventhubs/client/azure-eventhubs/src/main/java/com/azure/core/amqp/AmqpSession.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.core.amqp; | ||
|
||
import reactor.core.publisher.Mono; | ||
|
||
import java.io.Closeable; | ||
import java.time.Duration; | ||
|
||
/** | ||
* An AMQP session representing bidirectional communication that supports multiple {@link AmqpLink}. | ||
*/ | ||
public interface AmqpSession extends EndpointStateNotifier, Closeable { | ||
/** | ||
* Gets the entity path for this AMQP session. | ||
* | ||
* @return The entity path for the AMQP session. | ||
*/ | ||
String getSessionName(); | ||
|
||
/** | ||
* Gets the operation timeout for starting the AMQP session. | ||
* | ||
* @return The timeout for starting the AMQP session. | ||
*/ | ||
Duration getOpenTimeout(); | ||
|
||
/** | ||
* Creates a new AMQP sender link. | ||
* | ||
* @param linkName Name of the link. | ||
* @param timeout Timeout required for creating and opening AMPQ link. | ||
* @return A newly created AMQP link. | ||
*/ | ||
Mono<AmqpLink> createSender(String linkName, Duration timeout); | ||
|
||
/** | ||
* Creates a new AMQP receiver link. | ||
* | ||
* @param linkName Name of the link. | ||
* @param timeout Timeout required for creating and opening AMPQ link. | ||
* @return A newly created AMQP link. | ||
*/ | ||
Mono<AmqpLink> createReceiver(String linkName, Duration timeout); | ||
|
||
/** | ||
* Removes a {@link AmqpLink} with the given {@code linkName}. | ||
* | ||
* @param linkName Name of the link to remove. | ||
* @return {@code true} if the link was removed; {@code false} otherwise. | ||
*/ | ||
boolean removeLink(String linkName); | ||
} |
Oops, something went wrong.