-
Notifications
You must be signed in to change notification settings - Fork 71
Getting Started
Mert Kara edited this page Mar 29, 2018
·
9 revisions
We assume you have already installed node.js. If you haven't see the instructions here
- Install Yeoman and generator-appdirect-connector using npm ().
npm install -g yo
npm install -g generator-appdirect-connector
- Generate your new project:
yo appdirect-connector:java
- Include a dependency on the latest version of the sdk in your pom.xml
<dependency>
<groupId>com.appdirect</groupId>
<artifactId>service-integration-sdk</artifactId>
<version>1.15</version>
</dependency>
- Import
ConnectorSdkConfiguration
class in your application context; Use the import annotation@Import(ConnectorSdkConfiguration.class)
. i.e.
@SpringBootApplication
@Import(ConnectorSdkConfiguration.class)
public class MinimalConnector {
// your code...
}
-
Include a
DeveloperSpecificAppmarketCredentialsSupplier
bean in your application context that returns valid appmarket credentials given a consumer key. -
Include a
AppmarketEventHandler<T>
bean in your application context for every type of mandatory market events.
- Not providing handler for a mandatory event types will lead to an application context failure.
- The events you need to expose
AppmarketEventHandler
s for are
- Optional events can be handled if need be.
- Add
AppmarketEventHandler<T>
beans for every desired events and annotate it with@Primary
.
@Primary
@Bean
public AppmarketEventHandler<SubscriptionOrder> mySubscriptionOrderHandler() {
return event -> ApiResult.success("My handler for a SUBSCRIPTION_ORDER event");
}
- Available optional events:
- If an slf4j implementation is used for logging, the content of the x-request-id HTTP header (if any) is available in the logging context under the key
requestId
. Example: if logback is used, the pattern might look like the following:
%d{HH:mm:ss.SSS} %-5level %logger{24} - requestId: %X{requestId} - %msg%n