response streaming.md

Host ai workflow runner with Spring Boot: streamed responses

Summary

Deploy an AI workflow runner built with Spring Boot on Ample using the streaming response service pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL, with a managed PostgreSQL 16 database auto-provisioned and injected as DATABASE_URL. Verified on Spring Boot: a Server-Sent Events endpoint read incrementally through the public HTTPS gateway, with five one-second chunks arrived spread over time. This confirmed a 70-second stream of 36 chunks, which surpassed common 60-second idle timeouts and observed a client disconnect after two chunks (disconnected=true).

Infrastructure requirements

Prerequisites

Exact tested configuration

Steps

  1. Build and start. Run ./mvnw -q -DskipTests package (or the Gradle wrapper) to produce one application jar, then java -jar on the jvm-21 template (Temurin JDK 21) with server.port read from PORT. The server must bind 0.0.0.0 on PORT.
  2. Implement the pattern on PostgreSQL. The fixture's module implements streaming response service: a Server-Sent Events endpoint read incrementally through the public HTTPS gateway, conducting a 70-second stream of 36 chunks. Follow the approach in your schema; ensure migrations are idempotent and run them with --release-command.
  3. Deploy. Run the synchronous deploy once to read the result:
    ample deploy . --name <app-name> --public
    
  4. Verify. Fetch the live URL and self-test route(s) from the example; run own checks. On failure read ample logs <deployment_id> --kind build then --kind runtime.
    ample logs <deployment_id> --kind build
    

Success checks

Limitations

Cost estimate

Estimated 10.00 USD per month:

Verification evidence

Execution binding

MCP tool ample_deploy, schema hash 876465fce906da0c, binding state current, required scopes: servers:write, databases:read.