-
Notifications
You must be signed in to change notification settings - Fork 15
Add large payload support #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
38ab889
initial commit
bachuv 7e05e11
removed unnecessary variable in test
bachuv 3398336
addressed copilot comments
bachuv ba82668
fixed tests
bachuv 35af38c
Merge branch 'main' into vabachu/large-payload
bachuv 8a8b217
addressed pr feedback
bachuv a87110e
addressed copilot agent feedback
bachuv 1b64060
fixed tests
bachuv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,88 @@ | ||
| /* | ||
| * Build file for the azure-blob-payloads module. | ||
| * Provides a BlobPayloadStore implementation for externalizing large payloads to Azure Blob Storage. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'java-library' | ||
| id 'maven-publish' | ||
| id 'signing' | ||
| id 'com.github.spotbugs' version '6.4.8' | ||
| } | ||
|
|
||
| group 'com.microsoft' | ||
| version = '1.7.0' | ||
| archivesBaseName = 'durabletask-azure-blob-payloads' | ||
|
|
||
| def azureStorageBlobVersion = '12.30.0' | ||
| def azureCoreVersion = '1.57.1' | ||
| def azureIdentityVersion = '1.18.1' | ||
|
|
||
| dependencies { | ||
| api project(':client') | ||
| implementation "com.azure:azure-storage-blob:${azureStorageBlobVersion}" | ||
| implementation "com.azure:azure-core:${azureCoreVersion}" | ||
| implementation "com.azure:azure-identity:${azureIdentityVersion}" | ||
|
|
||
| testImplementation(platform('org.junit:junit-bom:5.14.2')) | ||
| testImplementation('org.junit.jupiter:junit-jupiter') | ||
| testRuntimeOnly('org.junit.platform:junit-platform-launcher') | ||
| testImplementation 'org.mockito:mockito-core:5.21.0' | ||
| testImplementation 'org.mockito:mockito-junit-jupiter:5.21.0' | ||
| } | ||
|
|
||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
|
||
| test { | ||
| useJUnitPlatform() | ||
| } | ||
|
|
||
| publishing { | ||
| repositories { | ||
| maven { | ||
| url "file://$project.rootDir/repo" | ||
| } | ||
| } | ||
| publications { | ||
| mavenJava(MavenPublication) { | ||
| from components.java | ||
| artifactId = archivesBaseName | ||
| pom { | ||
| name = 'Durable Task Azure Blob Payloads for Java' | ||
| description = 'This package provides an Azure Blob Storage implementation of PayloadStore for externalizing large payloads in the Durable Task Java SDK.' | ||
| url = "https://github.com/microsoft/durabletask-java/tree/main/azure-blob-payloads" | ||
| licenses { | ||
| license { | ||
| name = "MIT License" | ||
| url = "https://opensource.org/licenses/MIT" | ||
| distribution = "repo" | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| id = "Microsoft" | ||
| name = "Microsoft Corporation" | ||
| } | ||
| } | ||
| scm { | ||
| connection = "scm:git:https://github.com/microsoft/durabletask-java" | ||
| developerConnection = "scm:git:git@github.com:microsoft/durabletask-java" | ||
| url = "https://github.com/microsoft/durabletask-java/tree/main/azure-blob-payloads" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| signing { | ||
| required { gradle.taskGraph.hasTask("publish") } | ||
| sign publishing.publications.mavenJava | ||
| } | ||
|
|
||
| spotbugs { | ||
| ignoreFailures = false | ||
| effort = 'max' | ||
| reportLevel = 'medium' | ||
| excludeFilter = file('spotbugs-exclude.xml') | ||
| } | ||
This file contains hidden or 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,11 @@ | ||
| <FindBugsFilter> | ||
| <!-- BlobServiceClient is an Azure SDK client that is intentionally shared, not defensively copied --> | ||
| <Match> | ||
| <Class name="com.microsoft.durabletask.azureblobpayloads.BlobPayloadStoreOptions" /> | ||
| <Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2" /> | ||
| </Match> | ||
| <Match> | ||
| <Class name="com.microsoft.durabletask.azureblobpayloads.BlobPayloadStoreOptions$Builder" /> | ||
| <Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2" /> | ||
| </Match> | ||
| </FindBugsFilter> |
113 changes: 113 additions & 0 deletions
113
...rc/main/java/com/microsoft/durabletask/azureblobpayloads/AzureBlobPayloadsExtensions.java
This file contains hidden or 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,113 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.microsoft.durabletask.azureblobpayloads; | ||
|
|
||
| import com.microsoft.durabletask.DurableTaskGrpcClientBuilder; | ||
| import com.microsoft.durabletask.DurableTaskGrpcWorkerBuilder; | ||
| import com.microsoft.durabletask.LargePayloadOptions; | ||
|
|
||
| /** | ||
| * Extension methods for configuring Azure Blob Storage-based payload externalization | ||
| * on Durable Task builders. | ||
| * <p> | ||
| * Example: | ||
| * <pre>{@code | ||
| * BlobPayloadStoreOptions storeOptions = new BlobPayloadStoreOptions.Builder() | ||
| * .setConnectionString("DefaultEndpointsProtocol=https;...") | ||
| * .build(); | ||
| * | ||
| * DurableTaskGrpcWorkerBuilder workerBuilder = new DurableTaskGrpcWorkerBuilder(); | ||
| * AzureBlobPayloadsExtensions.useBlobStoragePayloads(workerBuilder, storeOptions); | ||
| * | ||
| * DurableTaskGrpcClientBuilder clientBuilder = new DurableTaskGrpcClientBuilder(); | ||
| * AzureBlobPayloadsExtensions.useBlobStoragePayloads(clientBuilder, storeOptions); | ||
| * }</pre> | ||
| * | ||
| * @see BlobPayloadStore | ||
| * @see BlobPayloadStoreOptions | ||
| */ | ||
| public final class AzureBlobPayloadsExtensions { | ||
|
|
||
| private AzureBlobPayloadsExtensions() { | ||
| } | ||
|
|
||
| /** | ||
| * Configures the worker builder to use Azure Blob Storage for large payload externalization | ||
| * with default {@link LargePayloadOptions}. | ||
| * | ||
| * @param builder the worker builder to configure | ||
| * @param storeOptions the blob payload store configuration | ||
| */ | ||
| public static void useBlobStoragePayloads( | ||
| DurableTaskGrpcWorkerBuilder builder, | ||
| BlobPayloadStoreOptions storeOptions) { | ||
| if (builder == null) { | ||
| throw new IllegalArgumentException("builder must not be null"); | ||
| } | ||
| if (storeOptions == null) { | ||
| throw new IllegalArgumentException("storeOptions must not be null"); | ||
| } | ||
| builder.useExternalizedPayloads(new BlobPayloadStore(storeOptions)); | ||
| } | ||
|
|
||
| /** | ||
| * Configures the worker builder to use Azure Blob Storage for large payload externalization | ||
| * with custom {@link LargePayloadOptions}. | ||
| * | ||
| * @param builder the worker builder to configure | ||
| * @param storeOptions the blob payload store configuration | ||
| * @param payloadOptions the large payload threshold options | ||
| */ | ||
| public static void useBlobStoragePayloads( | ||
| DurableTaskGrpcWorkerBuilder builder, | ||
| BlobPayloadStoreOptions storeOptions, | ||
| LargePayloadOptions payloadOptions) { | ||
| if (builder == null) { | ||
| throw new IllegalArgumentException("builder must not be null"); | ||
| } | ||
| if (storeOptions == null) { | ||
| throw new IllegalArgumentException("storeOptions must not be null"); | ||
| } | ||
| builder.useExternalizedPayloads(new BlobPayloadStore(storeOptions), payloadOptions); | ||
| } | ||
|
|
||
| /** | ||
| * Configures the client builder to use Azure Blob Storage for large payload externalization | ||
| * with default {@link LargePayloadOptions}. | ||
| * | ||
| * @param builder the client builder to configure | ||
| * @param storeOptions the blob payload store configuration | ||
| */ | ||
| public static void useBlobStoragePayloads( | ||
| DurableTaskGrpcClientBuilder builder, | ||
| BlobPayloadStoreOptions storeOptions) { | ||
| if (builder == null) { | ||
| throw new IllegalArgumentException("builder must not be null"); | ||
| } | ||
| if (storeOptions == null) { | ||
| throw new IllegalArgumentException("storeOptions must not be null"); | ||
| } | ||
| builder.useExternalizedPayloads(new BlobPayloadStore(storeOptions)); | ||
| } | ||
|
|
||
| /** | ||
| * Configures the client builder to use Azure Blob Storage for large payload externalization | ||
| * with custom {@link LargePayloadOptions}. | ||
| * | ||
| * @param builder the client builder to configure | ||
| * @param storeOptions the blob payload store configuration | ||
| * @param payloadOptions the large payload threshold options | ||
| */ | ||
| public static void useBlobStoragePayloads( | ||
| DurableTaskGrpcClientBuilder builder, | ||
| BlobPayloadStoreOptions storeOptions, | ||
| LargePayloadOptions payloadOptions) { | ||
| if (builder == null) { | ||
| throw new IllegalArgumentException("builder must not be null"); | ||
| } | ||
| if (storeOptions == null) { | ||
| throw new IllegalArgumentException("storeOptions must not be null"); | ||
| } | ||
| builder.useExternalizedPayloads(new BlobPayloadStore(storeOptions), payloadOptions); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.