Basic Project Setup
Basic project setup for gradle project should look like this:
build.gradle
Most important part here is spring-boot-starter
and adapter-sdk
dependencies.
Example file can be found here.
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation group: "com.stibo.leap", name: "adapter-sdk", version: "0.0.1-SNAPSHOT", changing: true
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.kafka:spring-kafka-test'
// Jupiter
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
spring.application.name: sdk-demo-adapter
application.yaml
Basic configuration should contain application name. This name will be used to register with Eureka and connect to the correct Kafka topics. No other configuration should be required to run adapter with default configs.
Example file can be found in demo adapter implementation here.
spring.application.name: sdk-demo-adapter
Application.java
Main class for adapter application. No additional configuration should be needed to run adapter.
Example file can be found in demo adapter implementation here.
package com.stibo.leap.sdkdemo;
import org.springframework.boot.SpringApplication;
import com.stibo.leap.adapter.AdapterApplication;
@AdapterApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
ApplicationTest.java
This simple test is the easiest way to check if all required components and configurations are in place. If not, some useful errors should be reported that will help to solve the issue - we will talk about it in the next section.
Example file can be found in demo adapter implementation here.
package com.stibo.leap.sdkdemo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.kafka.test.context.EmbeddedKafka;
@SpringBootTest(classes = Application.class)
@EmbeddedKafka(partitions = 1, brokerProperties = { "listeners=PLAINTEXT://localhost:9092", "port=9092" })
public class ApplicationTest {
@Test
public void contextLoads() {
}
}
Updated over 1 year ago