Quick start
Quick start
Pick the line that matches your Micronaut version:
| conta-command | Micronaut | Java | conta-problem-json |
|---|---|---|---|
0.3.x |
5 |
25 |
2.x |
0.2.x |
4 |
17 |
1.x |
Add the Conta Open repository and the tracing dependency:
repositories {
mavenCentral()
maven {
name = 'contaOpen'
url = 'https://gitlab.com/api/v4/groups/12992043/-/packages/maven'
}
}
dependencies {
implementation "no.conta.command:conta-command-tracing-mn:${contaCommandVersion}"
}
Implement a CommandTracingEventPublisher to decide how traced commands are persisted; the persistence guide wires the whole chain.
Annotate a controller or method with @CommandTracing:
@CommandTracing
@Controller("/orders")
public class OrderController {
@Post
public Order createOrder(@Valid @Body CreateOrderCommand cmd) {
// The first Command parameter is automatically detected and traced
return orderService.create(cmd);
}
}
The interceptor finds the Command parameter, and the filter captures the HTTP response to complete the trace.