Skip to content

Commit 3750725

Browse files
authored
Merge pull request #16 from Backbase/ssdk/create_outbound_integration4
Open API outbound integration example.
2 parents 493b198 + b9cdfc9 commit 3750725

File tree

30 files changed

+1004
-0
lines changed

30 files changed

+1004
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
service-sdk/12.1.0/.idea/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This project contains code samples documented in the following sections in [Backbase Community](https://community.backbase.com/documentation/ServiceSDK/latest/index)
2+
3+
* [Integrate your service with an external service](https://community.backbase.com/documentation/ServiceSDK/latest/create_outbound_integration_service)
4+
* [Enable service to service communications](https://community.backbase.com/documentation/ServiceSDK/latest/service_to_service_communication)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
**/*.iml
2+
**/*.ipr
3+
**/*.iws
4+
**/*.log
5+
**/.classpath
6+
**/.idea/
7+
**/.project
8+
**/.settings
9+
**/target/
10+
**/*.class
11+
12+
# General
13+
.DS_Store
14+
.AppleDouble
15+
.LSOverride
16+
17+
18+
.vscode/*
19+
!.vscode/settings.json
20+
!.vscode/tasks.json
21+
!.vscode/launch.json
22+
!.vscode/extensions.json
23+
*.code-workspace
24+
25+
# Local History for Visual Studio Code
26+
.history/
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# example-integration-service
2+
3+
_Fill out this file with some information about your Service._
4+
5+
#Getting Started
6+
* [Extend and build](https://community.backbase.com/documentation/ServiceSDK/latest/extend_and_build)
7+
8+
## Dependencies
9+
10+
Requires a running Eureka registry, by default on port 8080.
11+
12+
## Configuration
13+
14+
Service configuration is under `src/main/resources/application.yml`.
15+
16+
## Running
17+
18+
To run the service in development mode, use:
19+
- `mvn spring-boot:run`
20+
21+
To run the service from the built binaries, use:
22+
- `java -jar target/example-integration-service-1.0.0-SNAPSHOT.jar`
23+
24+
## Authorization
25+
26+
Requests to this service are authorized with a Backbase Internal JWT, therefore you must access this service via the
27+
Backbase Gateway after authenticating with the authentication service.
28+
29+
For local development, an internal JWT can be created from http://jwt.io, entering `JWTSecretKeyDontUseInProduction!`
30+
as the secret in the signature to generate a valid signed JWT.
31+
32+
## Community Documentation
33+
34+
Add links to documentation including setup, config, etc.
35+
36+
## Jira Project
37+
38+
Add link to Jira project.
39+
40+
## Confluence Links
41+
Links to relevant confluence pages (design etc).
42+
43+
## Support
44+
45+
The official example-integration-service support room is [#s-example-integration-service](https://todo).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>2.3.8.RELEASE</version>
10+
<relativePath /> <!-- lookup parent from repository -->
11+
</parent>
12+
13+
<groupId>com.backbase.example</groupId>
14+
<artifactId>example-integration-service</artifactId>
15+
<version>1.0.0-SNAPSHOT</version>
16+
<packaging>war</packaging>
17+
<name>Backbase :: Digital Banking Services :: example-integration-service</name>
18+
19+
<properties>
20+
<java.version>11</java.version>
21+
</properties>
22+
23+
<dependencyManagement>
24+
<dependencies>
25+
<dependency>
26+
<groupId>com.backbase.buildingblocks</groupId>
27+
<version>12.1.0</version>
28+
<artifactId>service-sdk-starter-core</artifactId>
29+
<type>pom</type>
30+
<scope>import</scope>
31+
</dependency>
32+
</dependencies>
33+
</dependencyManagement>
34+
35+
<!-- Add dependencies for your integration services, e.g. BB raml specifications,
36+
integration clients -->
37+
38+
<!-- Uncomment the following dependency if DBS inter-service communication
39+
is needed -->
40+
<!-- <dependency>
41+
<groupId>com.backbase.buildingblocks</groupId>
42+
<artifactId>communication</artifactId>
43+
</dependency> -->
44+
<dependencies>
45+
<dependency>
46+
<groupId>com.backbase.buildingblocks</groupId>
47+
<artifactId>service-sdk-starter-core</artifactId>
48+
<type>pom</type>
49+
</dependency>
50+
<dependency>
51+
<groupId>com.backbase.buildingblocks</groupId>
52+
<artifactId>service-sdk-starter-test</artifactId>
53+
<scope>test</scope>
54+
</dependency>
55+
</dependencies>
56+
57+
<build>
58+
<plugins>
59+
<!-- Optionally, use the backbase-loader-tool application launcher
60+
The backbase-loader-tool is a Spring Boot application launcher that lets
61+
you add classpath dependencies to applications packaged as bootable jars
62+
at runtime using the loader.path system property.
63+
To use the backbase-loader-tool, add the following maven plugin
64+
under project/build/plugins in your POM file: -->
65+
<!--
66+
<plugin>
67+
<groupId>org.springframework.boot</groupId>
68+
<artifactId>spring-boot-maven-plugin</artifactId>
69+
<executions>
70+
<execution>
71+
<id>repackage</id>
72+
<goals>
73+
<goal>build-info</goal>
74+
<goal>repackage</goal>
75+
</goals>
76+
<configuration>
77+
<classifier>boot</classifier>
78+
</configuration>
79+
</execution>
80+
</executions>
81+
<dependencies>
82+
<!-- Add artifact containing custom factory as plugin
83+
dependency -\\->
84+
<dependency>
85+
<groupId>com.backbase.buildingblocks</groupId>
86+
<artifactId>backbase-loader-tool</artifactId>
87+
<version>12.1.0</version>
88+
</dependency>
89+
</dependencies>
90+
<configuration>
91+
<!-- Use custom layout factory -\\->
92+
<layoutFactory
93+
implementation="com.backbase.boot.layout.BackbaseLayoutFactory" />
94+
<environmentVariables>
95+
<SIG_SECRET_KEY>JWTSecretKeyDontUseInProduction!</SIG_SECRET_KEY>
96+
</environmentVariables>
97+
</configuration>
98+
</plugin>
99+
-->
100+
</plugins>
101+
</build>
102+
</project>
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<!-- The simplest way to build a service with service-sdk-starter-core
7+
is to use it as a parent in your project’s POM file, alternatively if you
8+
don’t want to use service-sdk-starter-core as your project’s parent, you
9+
can declare it as a dependency instead, see pom-as-dependency.xml -->
10+
<parent>
11+
<groupId>com.backbase.buildingblocks</groupId>
12+
<version>12.1.0</version>
13+
<artifactId>service-sdk-starter-core</artifactId>
14+
<relativePath />
15+
</parent>
16+
17+
<groupId>com.backbase.example</groupId>
18+
<artifactId>example-integration-service</artifactId>
19+
<version>1.0.0-SNAPSHOT</version>
20+
<packaging>war</packaging>
21+
<name>Backbase :: example-integration-service</name>
22+
23+
<properties>
24+
<java.version>11</java.version>
25+
<boat-maven-plugin.version>0.14.1</boat-maven-plugin.version>
26+
<open-api-specs-dir>${project.build.directory}/specs</open-api-specs-dir>
27+
<!-- required for generated api -->
28+
<swagger-annotations.version>1.6.2</swagger-annotations.version>
29+
<jackson-databind-nullable.version>0.2.1</jackson-databind-nullable.version>
30+
</properties>
31+
32+
<dependencies>
33+
<dependency>
34+
<groupId>com.backbase.buildingblocks</groupId>
35+
<artifactId>service-sdk-starter-test</artifactId>
36+
<scope>test</scope>
37+
</dependency>
38+
39+
<!-- Add dependencies for your services, e.g. API Specs, integration clients -->
40+
41+
<!-- Uncomment the following dependency if DBS inter-service communication is needed -->
42+
<!-- tag::spec-and-dependency[] -->
43+
<dependency>
44+
<groupId>com.backbase.buildingblocks</groupId>
45+
<artifactId>communication</artifactId>
46+
</dependency>
47+
<dependency>
48+
<groupId>com.backbase.buildingblocks</groupId>
49+
<artifactId>service-sdk-starter-mapping</artifactId>
50+
</dependency>
51+
<dependency>
52+
<groupId>com.backbase.buildingblocks</groupId>
53+
<artifactId>service-sdk-test-utils</artifactId>
54+
<scope>test</scope>
55+
</dependency>
56+
<dependency>
57+
<groupId>io.swagger</groupId>
58+
<artifactId>swagger-annotations</artifactId>
59+
<version>${swagger-annotations.version}</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.openapitools</groupId>
63+
<artifactId>jackson-databind-nullable</artifactId>
64+
<version>${jackson-databind-nullable.version}</version>
65+
</dependency>
66+
<!-- end::spec-and-dependency[] -->
67+
</dependencies>
68+
69+
<build>
70+
<plugins>
71+
<!-- tag::maven-plugin[] -->
72+
<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-dependency-plugin</artifactId>
75+
<version>3.1.2</version>
76+
<executions>
77+
<execution>
78+
<id>unpack</id>
79+
<phase>initialize</phase>
80+
<goals>
81+
<goal>unpack</goal>
82+
</goals>
83+
<configuration>
84+
<artifactItems>
85+
<artifactItem>
86+
<groupId>com.backbase.poc</groupId>
87+
<artifactId>example-integration-spec</artifactId>
88+
<version>1.0.0-SNAPSHOT</version>
89+
<type>jar</type>
90+
<outputDirectory>${open-api-specs-dir}/example-integration-spec/</outputDirectory>
91+
<includes>**/*.yaml,**/*.json</includes>
92+
</artifactItem>
93+
</artifactItems>
94+
<includes>**/*.java</includes>
95+
<excludes>**/*.properties</excludes>
96+
<outputDirectory>${project.build.directory}/wars</outputDirectory>
97+
<overWriteReleases>false</overWriteReleases>
98+
<overWriteSnapshots>true</overWriteSnapshots>
99+
</configuration>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
<!-- end::maven-plugin[] -->
104+
105+
<!-- tag::boat-plugin[] -->
106+
<plugin>
107+
<groupId>com.backbase.oss</groupId>
108+
<artifactId>boat-maven-plugin</artifactId>
109+
<version>${boat-maven-plugin.version}</version>
110+
<executions>
111+
<!-- Generate OpenAPI interface stubs. -->
112+
<execution>
113+
<id>generate-payment-order-template-client-api-code</id>
114+
<goals>
115+
<goal>generate-spring-boot-embedded</goal>
116+
</goals>
117+
<phase>generate-sources</phase>
118+
<configuration>
119+
<inputSpec>
120+
${open-api-specs-dir}/example-integration-spec/client-api-v1.yaml
121+
</inputSpec>
122+
<apiPackage>com.backbase.example.api.client.v1</apiPackage>
123+
<modelPackage>com.backbase.example.api.client.v1.model</modelPackage>
124+
</configuration>
125+
</execution>
126+
</executions>
127+
</plugin>
128+
<!-- end::boat-plugin[] -->
129+
</plugins>
130+
</build>
131+
132+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.backbase.example;
2+
3+
import org.springframework.boot.autoconfigure.SpringBootApplication;
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
6+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7+
8+
@SpringBootApplication
9+
@EnableDiscoveryClient
10+
public class Application extends SpringBootServletInitializer {
11+
12+
public static void main(final String[] args) {
13+
SpringApplication.run(Application.class, args);
14+
}
15+
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.backbase.example;
2+
3+
import com.backbase.buildingblocks.presentation.errors.InternalServerErrorException;
4+
import com.backbase.example.api.client.v1.MessageApi;
5+
import com.backbase.example.api.client.v1.model.MessagePostResponseBody;
6+
import com.backbase.example.integration.MessageClient;
7+
import com.backbase.example.mapper.IntegrationMessageMapper;
8+
import com.backbase.example.model.Message;
9+
import java.io.IOException;
10+
import java.util.List;
11+
import javax.validation.Valid;
12+
import javax.validation.constraints.NotNull;
13+
import org.springframework.beans.factory.annotation.Autowired;
14+
import org.springframework.http.HttpStatus;
15+
import org.springframework.http.ResponseEntity;
16+
import org.springframework.web.bind.annotation.RestController;
17+
18+
@RestController
19+
public class ExampleController implements MessageApi {
20+
21+
@Autowired
22+
private MessageClient messageClient;
23+
24+
@Override
25+
public ResponseEntity<Void> deleteMessage(@Valid @NotNull String id) {
26+
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
27+
}
28+
29+
30+
@Override
31+
public ResponseEntity<com.backbase.example.api.client.v1.model.Message> getMessage(@Valid @NotNull String id) {
32+
33+
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
34+
}
35+
36+
// tag::getIntegration[]
37+
@Override
38+
public ResponseEntity<List<com.backbase.example.api.client.v1.model.Message>> getMessages() {
39+
List<Message> messages = null;
40+
41+
try {
42+
messages = messageClient.getMessages();
43+
} catch (IOException e) {
44+
throw new InternalServerErrorException("Error has occurred sending message");
45+
}
46+
47+
return ResponseEntity.ok(IntegrationMessageMapper.INSTANCE.messagesToIntegrationGetResponseBodys(messages));
48+
}
49+
// end::getIntegration[]
50+
51+
@Override
52+
public ResponseEntity<MessagePostResponseBody> postMessage(
53+
com.backbase.example.api.client.v1.model.@Valid Message message) {
54+
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
55+
}
56+
57+
@Override
58+
public ResponseEntity<Void> putMessage(com.backbase.example.api.client.v1.model.@Valid Message message) {
59+
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
60+
}
61+
62+
}

0 commit comments

Comments
 (0)