How phaneesh/revolver works
Project type and purpose
• This is an open-source Dropwizard bundle (“dropwizard-revolver”) that lets you build downstream HTTP/HTTPS proxies with:
• Transparent callbacks (async workflows)
• A durable mailbox (polling for request/response status)
• Pluggable persistence (in-memory or Aerospike)
• Runtime features (circuit breakers via Hystrix, service discovery, dynamic config, request splitting, retries, tracing, metrics optimization)
• It also ships a small dashboard UI (static HTML/CSS/JS under src/main/resources/revolver/dashboard) for monitoring.
File structure
• Top‐level: pom.xml, README, Travis config.
• src/main/java/io/dropwizard/revolver: core code organized into packages:
• bundle (RevolverBundle)
• base, core (command infrastructure, models, context, exception helpers)
• discovery (service resolver, EndpointSpec)
• http (HTTP command, client factory, auth, API/service config)
• persistence (AeroSpikePersistenceProvider, InMemoryPersistenceProvider)
• callback (CallbackHandler, InlineCallbackHandler)
• resource (JAX-RS endpoints for mailbox, requests, callbacks, config, metadata)
• filters (RevolverRequestFilter)
• retry, splitting (strategy-based retry and request splitting)
• optimizer (metrics collection, config updater)
• util, tracing
• src/main/resources/revolver/dashboard: static UI assets.
• Tests mirror main packages.
Key insights from README
• You plug this bundle into any Dropwizard app by calling bootstrap.addBundle(new RevolverBundle<>() { … })
• You supply RevolverConfig (via YAML) and a PersistenceProvider implementation
• Bundle registers: commands + Hystrix circuit-breakers, mailbox polling endpoints, callback endpoints, dashboard resource
1. Dropwizard Application
– Your app’s Bootstrap & Environment
– Registers RevolverBundle
2. RevolverBundle
– Initializes:
• Core Command Framework (RevolverCommand, SimpleRevolverCommand)
• Service Discovery Module
• HTTP/HTTPS Command Module (RevolverHttpCommand)
• Persistence Module (InMemory or Aerospike)
• Callback Module
• Retry & Splitting Modules
• Optimizer Module (metrics collection + config updater)
• JAX-RS Resources (Mailbox, Request, Callback, Config, Metadata, Dashboard)
• Filters (RevolverRequestFilter)
3. External Services
– Downstream HTTP/HTTPS endpoints (e.g., mocky.io)
– Service discovery backends (Zookeeper via Curator if used)
4. Persistence Store
– In-memory or Aerospike
5. Client & Dashboard UI
– End users or other services call API endpoints (sync/async)
– Dashboard (static assets) polls Metadata & Config endpoints
b. Relationships & data flow
1. Client → HTTP Request → Dropwizard JAX-RS → RevolverRequestResource
2. RevolverRequestResource → RevolverCommandFactory → SimpleRevolverCommand
3. Command executes:
• ServiceResolver locates an endpoint
• RevolverHttpClientFactory builds HTTP client → sends request to external service
• Hystrix wraps call (CircuitBreaker, ThreadPool)
4. Response → persisted via PersistenceProvider → mailbox queue
5. If callback configured: CallbackHandler picks up response → forwards to callback URL
6. Client polls mailbox via RevolverMailboxResource → reads status from PersistenceProvider
7. OptimizerMetricsCollector gathers runtime metrics → OptimizerConfigUpdater tweaks RuntimeConfig (thread-pool sizes, timeouts)
8. Dashboard UI fetches metadata & status via RevolverMetadataResource & RevolverConfigResource
c. Architectural patterns & principles
• Bundle pattern (Dropwizard extension)
• Command pattern (RevolverCommand)
• Strategy pattern (splitting, retry, persistence provider, auth, service discovery)
• Circuit breaker pattern (Hystrix integration)
• Plugin/extensibility (PersistenceProvider, ServiceDiscoveryConfig, AuthConfig)
• MVC-style separation: resources (controllers) → core (services) → persistence
d. Key technologies & frameworks
• Dropwizard (JAX-RS, Jackson, Metrics)
• Apache Curator (service discovery via Zookeeper)
• Hystrix (circuit breaker, thread-pools, metrics)
• Aerospike (optional persistence)
• MsgPack & XML bundles (content negotiation)
• Static dashboard: Materialize CSS, JS