Skip to content

Add Java Durable Entity samples#244

Draft
bachuv wants to merge 3 commits intoAzure-Samples:mainfrom
bachuv:vabachu/java-entity-samples
Draft

Add Java Durable Entity samples#244
bachuv wants to merge 3 commits intoAzure-Samples:mainfrom
bachuv:vabachu/java-entity-samples

Conversation

@bachuv
Copy link
Copy Markdown

@bachuv bachuv commented Apr 9, 2026

Purpose

Adding Java Durable Entity samples. Creating the PR as a draft PR until the feature is released in the Durable Java SDK.

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone https://github.com/bachuv/Durable-Task-Scheduler.git
cd Durable-Task-Scheduler
git checkout vabachu/java-entity-samples
  • Test the code

Prerequisites: Docker, Java 11+, Maven, Azure Functions Core Tools v4

Start local services

docker run --name dtsemulator -d -p 8080:8080 -p 8082:8082 mcr.microsoft.com/dts/dts-emulator:latest
docker run --name azurite -d -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite

Test durable-task-sdks/java entities sample (Gradle)

cd samples/durable-task-sdks/java/entities
./gradlew runEntitiesPattern

Test durable-functions/java Entities sample (Maven)

cd samples/durable-functions/java/Entities
mvn clean package
mvn azure-functions:run
# In another terminal:
curl -X POST "http://localhost:7071/api/SignalCounter?key=test&op=add&value=7"
curl "http://localhost:7071/api/GetCounter?key=test"
curl -X POST "http://localhost:7071/api/StartCounterOrchestration?key=test-orch"

Test durable-functions/java HelloCities sample (Maven, verify no regression)

cd samples/durable-functions/java/HelloCities
mvn clean package
mvn azure-functions:run

In another terminal:

curl -X POST http://localhost:7071/api/StartChaining
curl -X POST http://localhost:7071/api/StartFanOutFanIn

What to Check

Verify that the following are valid

  • SDK entities sample — ./gradlew runEntitiesPattern signals a counter entity directly, then runs 5 orchestrations that each produce final value: 12
  • Functions entities sample — SignalCounter returns 202, GetCounter returns the correct counter value as JSON, StartCounterOrchestration completes with final value: 12
  • Functions entities sample — SignalCounter?op=get returns 400 with a message pointing to GetCounter
  • HelloCities no regression — mvn clean package then mvn azure-functions:run still works; StartChaining and StartFanOutFanIn return orchestration results
  • READMEs — Run instructions in samples/durable-functions/java/README.md, HelloCities/README.md, and Entities/README.md match the actual commands needed

Other Information

  • The azure-functions-maven-plugin package goal is now bound to the Maven package phase in both Java Functions samples, so the standard two-step flow (mvn clean package + mvn azure-functions:run) works out of the box — matching the Java Durable Functions quickstart.
  • host.json storage provider type was changed from durabletask-scheduler to azureManaged in both HelloCities and Entities to match what the local Functions runtime recognizes.
  • The SDK sample uses durabletask-client:1.9.0 and durabletask-azuremanaged:1.9.0; the Functions sample uses durabletask-azure-functions:1.9.0.
  • Azurite is required locally because AzureWebJobsStorage=UseDevelopmentStorage=true in local.settings.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant