How to implement SAGA Distributed Transactions Pattern using Apache Camel | Microservices Design Pattern
Let’s learn how we can also provide typeahead support for our internal SpringBoot configuration properties so we don’t have to always look at the source code.
Code
How to automate database migration?
How to version control your database? Database migration using Flyway.
Tutorial Code
Code
Step-by-Step guide
Add dependnacy in pom.xml
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-openapi-java</artifactId>
<version>3.14.0</version> <!-- Same as Camel Core -->
</dependency>
Java
@Component
public class RestDsl extends RouteBuilder {
@Override
public void configure() throws Exception {
restConfiguration()
.component("servlet")
.bindingMode(RestBindingMode.json)
.dataFormatProperty("prettyPrint", "true")
.apiContextPath("/api-doc")
.apiProperty("api.title", "Saggu.UK Camel Rest APIs")
.apiProperty("api.version", "1.0")
.apiContextListing(true)
;
rest()
.consumes("application/json").produces("application/json")
.get("/weather/{city}")
.responseMessage("200", "On good request")
.responseMessage("404", "For invalid city name")
.description("Get weather data for a given city")
.param()
.name("city").type(path).description("The name of the city e.g. London").dataType("string")
.endParam()
.outType(WeatherDto.class).to("direct:get-weather-data")
}
}
What is Apache Camel Processor and how to use it? The Processor interface is used to implement consumers of message exchanges or to implement a Message Translator, and other use-cases.
Code
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.