Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions azure-blob-payloads/build.gradle
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 { !project.hasProperty("skipSigning") && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.mavenJava
}

spotbugs {
ignoreFailures = false
effort = 'max'
reportLevel = 'medium'
excludeFilter = file('spotbugs-exclude.xml')
}
11 changes: 11 additions & 0 deletions azure-blob-payloads/spotbugs-exclude.xml
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>
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);
}
}
Loading
Loading