Skip to content

Commit

Permalink
Merge pull request #16 from Backbase/ssdk/create_outbound_integration4
Browse files Browse the repository at this point in the history
Open API outbound integration example.
  • Loading branch information
SteveWyatt74 authored Mar 3, 2021
2 parents 493b198 + b9cdfc9 commit 3750725
Show file tree
Hide file tree
Showing 30 changed files with 1,004 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service-sdk/12.1.0/.idea/
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This project contains code samples documented in the following sections in [Backbase Community](https://community.backbase.com/documentation/ServiceSDK/latest/index)

* [Integrate your service with an external service](https://community.backbase.com/documentation/ServiceSDK/latest/create_outbound_integration_service)
* [Enable service to service communications](https://community.backbase.com/documentation/ServiceSDK/latest/service_to_service_communication)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
**/*.iml
**/*.ipr
**/*.iws
**/*.log
**/.classpath
**/.idea/
**/.project
**/.settings
**/target/
**/*.class

# General
.DS_Store
.AppleDouble
.LSOverride


.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# example-integration-service

_Fill out this file with some information about your Service._

#Getting Started
* [Extend and build](https://community.backbase.com/documentation/ServiceSDK/latest/extend_and_build)

## Dependencies

Requires a running Eureka registry, by default on port 8080.

## Configuration

Service configuration is under `src/main/resources/application.yml`.

## Running

To run the service in development mode, use:
- `mvn spring-boot:run`

To run the service from the built binaries, use:
- `java -jar target/example-integration-service-1.0.0-SNAPSHOT.jar`

## Authorization

Requests to this service are authorized with a Backbase Internal JWT, therefore you must access this service via the
Backbase Gateway after authenticating with the authentication service.

For local development, an internal JWT can be created from http://jwt.io, entering `JWTSecretKeyDontUseInProduction!`
as the secret in the signature to generate a valid signed JWT.

## Community Documentation

Add links to documentation including setup, config, etc.

## Jira Project

Add link to Jira project.

## Confluence Links
Links to relevant confluence pages (design etc).

## Support

The official example-integration-service support room is [#s-example-integration-service](https://todo).
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.8.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<groupId>com.backbase.example</groupId>
<artifactId>example-integration-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Backbase :: Digital Banking Services :: example-integration-service</name>

<properties>
<java.version>11</java.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<version>12.1.0</version>
<artifactId>service-sdk-starter-core</artifactId>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<!-- Add dependencies for your integration services, e.g. BB raml specifications,
integration clients -->

<!-- Uncomment the following dependency if DBS inter-service communication
is needed -->
<!-- <dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>communication</artifactId>
</dependency> -->
<dependencies>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>service-sdk-starter-core</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>service-sdk-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Optionally, use the backbase-loader-tool application launcher
The backbase-loader-tool is a Spring Boot application launcher that lets
you add classpath dependencies to applications packaged as bootable jars
at runtime using the loader.path system property.
To use the backbase-loader-tool, add the following maven plugin
under project/build/plugins in your POM file: -->
<!--
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>boot</classifier>
</configuration>
</execution>
</executions>
<dependencies>
<!-- Add artifact containing custom factory as plugin
dependency -\\->
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>backbase-loader-tool</artifactId>
<version>12.1.0</version>
</dependency>
</dependencies>
<configuration>
<!-- Use custom layout factory -\\->
<layoutFactory
implementation="com.backbase.boot.layout.BackbaseLayoutFactory" />
<environmentVariables>
<SIG_SECRET_KEY>JWTSecretKeyDontUseInProduction!</SIG_SECRET_KEY>
</environmentVariables>
</configuration>
</plugin>
-->
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<!-- The simplest way to build a service with service-sdk-starter-core
is to use it as a parent in your project’s POM file, alternatively if you
don’t want to use service-sdk-starter-core as your project’s parent, you
can declare it as a dependency instead, see pom-as-dependency.xml -->
<parent>
<groupId>com.backbase.buildingblocks</groupId>
<version>12.1.0</version>
<artifactId>service-sdk-starter-core</artifactId>
<relativePath />
</parent>

<groupId>com.backbase.example</groupId>
<artifactId>example-integration-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Backbase :: example-integration-service</name>

<properties>
<java.version>11</java.version>
<boat-maven-plugin.version>0.14.1</boat-maven-plugin.version>
<open-api-specs-dir>${project.build.directory}/specs</open-api-specs-dir>
<!-- required for generated api -->
<swagger-annotations.version>1.6.2</swagger-annotations.version>
<jackson-databind-nullable.version>0.2.1</jackson-databind-nullable.version>
</properties>

<dependencies>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>service-sdk-starter-test</artifactId>
<scope>test</scope>
</dependency>

<!-- Add dependencies for your services, e.g. API Specs, integration clients -->

<!-- Uncomment the following dependency if DBS inter-service communication is needed -->
<!-- tag::spec-and-dependency[] -->
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>communication</artifactId>
</dependency>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>service-sdk-starter-mapping</artifactId>
</dependency>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>service-sdk-test-utils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable.version}</version>
</dependency>
<!-- end::spec-and-dependency[] -->
</dependencies>

<build>
<plugins>
<!-- tag::maven-plugin[] -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>unpack</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.backbase.poc</groupId>
<artifactId>example-integration-spec</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>jar</type>
<outputDirectory>${open-api-specs-dir}/example-integration-spec/</outputDirectory>
<includes>**/*.yaml,**/*.json</includes>
</artifactItem>
</artifactItems>
<includes>**/*.java</includes>
<excludes>**/*.properties</excludes>
<outputDirectory>${project.build.directory}/wars</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<!-- end::maven-plugin[] -->

<!-- tag::boat-plugin[] -->
<plugin>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-maven-plugin</artifactId>
<version>${boat-maven-plugin.version}</version>
<executions>
<!-- Generate OpenAPI interface stubs. -->
<execution>
<id>generate-payment-order-template-client-api-code</id>
<goals>
<goal>generate-spring-boot-embedded</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<inputSpec>
${open-api-specs-dir}/example-integration-spec/client-api-v1.yaml
</inputSpec>
<apiPackage>com.backbase.example.api.client.v1</apiPackage>
<modelPackage>com.backbase.example.api.client.v1.model</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
<!-- end::boat-plugin[] -->
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.backbase.example;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient
public class Application extends SpringBootServletInitializer {

public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.backbase.example;

import com.backbase.buildingblocks.presentation.errors.InternalServerErrorException;
import com.backbase.example.api.client.v1.MessageApi;
import com.backbase.example.api.client.v1.model.MessagePostResponseBody;
import com.backbase.example.integration.MessageClient;
import com.backbase.example.mapper.IntegrationMessageMapper;
import com.backbase.example.model.Message;
import java.io.IOException;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ExampleController implements MessageApi {

@Autowired
private MessageClient messageClient;

@Override
public ResponseEntity<Void> deleteMessage(@Valid @NotNull String id) {
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}


@Override
public ResponseEntity<com.backbase.example.api.client.v1.model.Message> getMessage(@Valid @NotNull String id) {

return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

// tag::getIntegration[]
@Override
public ResponseEntity<List<com.backbase.example.api.client.v1.model.Message>> getMessages() {
List<Message> messages = null;

try {
messages = messageClient.getMessages();
} catch (IOException e) {
throw new InternalServerErrorException("Error has occurred sending message");
}

return ResponseEntity.ok(IntegrationMessageMapper.INSTANCE.messagesToIntegrationGetResponseBodys(messages));
}
// end::getIntegration[]

@Override
public ResponseEntity<MessagePostResponseBody> postMessage(
com.backbase.example.api.client.v1.model.@Valid Message message) {
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

@Override
public ResponseEntity<Void> putMessage(com.backbase.example.api.client.v1.model.@Valid Message message) {
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

}
Loading

0 comments on commit 3750725

Please sign in to comment.