SDA Dropwizard Commons is a set of libraries to bootstrap services easily that follow the patterns and specifications promoted by the SDA SE.
⚠️ ATTENTION: Please use SDA Dropwizard Commons version 2 and newer:New features and security patches are only contributed in version 2.x.x. As the support for Dropwizard version 1.3.x is discontinued, we also discontinued the version 1.x.x. Please make sure to upgrade to version 2 as soon as possible.
SDA Dropwizard Commons is separated in different modules that can be combined as needed. Most of the modules require the technologies that are recommended for services in the SDA Platform. These technologies include
Changelog and Versioning
This project adheres to Semantic Versioning.
See our changelog for more information about the latest features.
Contributing
We are looking forward to contributions. Take a look at our Contribution Guidelines before submitting Pull Requests.
Responsible Disclosure and Security
The SECURITY.md includes information on responsible disclosure and security related topics like security patches.
Modules in SDA Dropwizard Commons
Server
All modules prefixed with sda-commons-server-
provide technology and configuration support used in backend services to provide REST Endpoints.
Main Server Modules
The main server modules help to bootstrap and test a Dropwizard application with convergent dependencies.
Starter
The module sda-commons-starter
provides all basics required to build a service for the SDA Platform with Dropwizard.
The module sda-commons-starter-example
gives a small example on starting an application using defaults for the SDA Platform.
Testing
The module sda-commons-server-testing
is the base module to add unit and integration tests for applications in the SDA SE infrastructure.
Some modules have a more specialized testing module, e.g. the sda-commons-server-hibernate
module has a sda-commons-server-hibernate-testing
module, providing further support.
Additional Server Modules
The additional server modules add helpful technologies to the Dropwizard application.
Auth
The module sda-commons-server-auth
provides support to add authentication using JSON Web Tokens with different sources for the public keys of the signing authorities.
Circuit Breaker
The module sda-commons-server-circuitbreaker
provides support to inject circuit breakers into synchronous calls to other services.
Consumer Token
The module sda-commons-server-consumer
adds support to track or require a consumer token identifying the calling application.
Cross-Origin Resource Sharing
The module sda-commons-server-cors
adds support for CORS. This allows Cross-origin resource sharing for the service.
Dropwizard
The module sda-commons-server-dropwizard
provides io.dropwizard:dropwizard-core
with convergent dependencies. All other SDA Dropwizard Commons Server modules use this dependency and are aligned to the versions provided by sda-commons-server-dropwizard
. It also provides some common bundles that require no additional dependencies.
Health Check
The module sda-commons-server-healthcheck
introduces the possibility to distinguish internal and external health checks.
The module sda-commons-server-healthcheck-example
presents a simple application that shows the usage of the bundle and implementation of new health checks.
Hibernate
The module sda-commons-server-hibernate
provides access to relational databases with hibernate.
The module sda-commons-server-hibernate-exmaple
shows how to use the bundle within an application.
Jackson
The module sda-commons-server-jackson
is used for several purposes
- configure the
ObjectMapper
with the recommended default settings of SDA SE services. - provides support for linking resources with HAL
- adds the ability to filter fields on client request
- registers exception mapper to support the common error structure as defined within the rest guide
Forms
The module sda-commons-shared-forms
adds all required dependencies to support multipart/*
in Dropwizard applications.
Kafka
The module sda-commons-server-kafka
provides means to send and consume messages from a Kafka topic.
The module sda-commons-server-kafka-example
includes applications, one with consumer and one with producer examples.
MongoDB
The module sda-commons-server-morphia
is used to work with MongoDB using Morphia.
The module sda-commons-server-mongo-testing
provides a MongoDB instance for integration testing.
The module sda-commons-server-morphia-exmaple
shows how to use the bundle within an application.
Open Tracing
The module sda-commons-server-opentracing
provides OpenTracing instrumentation for JAX-RS. Other bundles like sda-commons-client-jersey
, sda-commons-server-morphia
or sda-commons-server-s3
come with built in instrumentation.
Besides instrumentation it's also required to specify a collector, like Jaeger. The module sda-commons-server-jaeger
provides the Jaeger collector.
The module sda-commons-server-opentracing-exmaple
shows how to use OpenTracing and Jaeger within an application and has examples for manual instrumentation.
Prometheus
The module sda-commons-server-prometheus
provides an admin endpoint to serve metrics in a format that Prometheus can read.
The module sda-commons-server-prometheus-example
presents a simple application that shows the three main types of metrics to use in a service.
S3 Object Storage
The module sda-commons-server-s3
provides a client for an AWS S3-compatible object storage.
The module sda-commons-server-s3-testing
is used to provide an AWS S3-compatible Object Storage during integrations tests.
Security
The module sda-commons-server-security
helps to configure a secure Dropwizard application.
Swagger
The module sda-commons-server-swagger
is the base module to add Swagger support for applications in the SDA SE infrastructure.
Trace Token
The module sda-commons-server-trace
adds support to track create a trace token to correlate a set of service invocations that belongs to the same logically cohesive call of a higher level service offered by the SDA Platform, e.g. interaction service. .
Weld
The module sda-commons-server-weld
is used to bootstrap Dropwizard applications inside a Weld-SE container and provides CDI support for servlets, listeners and resources.
The module sda-commons-server-weld-example
gives a small example on starting an application within an Weld container.
YAML
The module sda-commons-shared-yaml
adds support for YAML-file handling.
Client
All modules prefixed with sda-commons-client-
provide support for applications that use a HTTP client to access other services.
Jersey
The module sda-commons-client-jersey
provides support for using Jersey clients withing the Dropwizard application.
The module sda-commons-client-jersey-wiremock-testing
bundles the WireMock dependencies to mock services in integration tests consistently to sda-commons library versions.
The module sda-commons-client-jersey-example
presents an example application that shows how to invoke services.
Forms
The module sda-commons-shared-forms
adds all required dependencies to support multipart/*
in Dropwizard applications.
Usage
The compiled releases are publicly available via maven central.
Include sda-commons-bom
and sda-commons-dependencies
as platform constraints. You will inherit all versions defined there and won't have to specify versions for them yourself.
More details:
Note: You need Gradle 5.x for platform dependencies. More information can be found here.
project.ext {
sdaCommonsVersion = 'x.x.x'
}
dependencies {
// define platform dependencies for simplified dependency management
compile enforcedPlatform("org.sdase.commons.sda-commons-dependencies:$sdaCommonsVersion")
compile enforcedPlatform("org.sdase.commons.sda-commons-bom:$sdaCommonsVersion")
...
// Add dependencies to sda-commons-modules (managed by sda-commons-bom)
compile "org.sdase.commons:sda-commons-client-jersey"
...
// Add other dependencies (managed by 'sda-commons-dependencies')
compile 'org.glassfish.jersey.core:jersey-client'
// Add other unmanaged dependencies
compile 'org.apache.commons:commons-digester3:3.2'
}