-
Martin Vogel authored
refactor(config): remove implicit config loading, config can only be loaded via explicit env-var or ApplicationConfigLoader
Martin Vogel authoredrefactor(config): remove implicit config loading, config can only be loaded via explicit env-var or ApplicationConfigLoader
Client Module
Commandline Client
The sdk comes with a commandline client to be able to use the sdk without any coding.
Setup & Build
- Build project root wih
./mvnw clean package
- Go to client/target and find a runnable jar
client-VERSION.jar
- Provide config either via env-var or by loading it programmatically:
- set environment variable
FIT_CONNECT_CONFIG
:- Linux/MacOS:
export FIT_CONNECT_CONFIG=path/to/config.yml
- Windows:
set FIT_CONNECT_CONFIG=C:\Path\To\config.yml
- Linux/MacOS:
- Initialize client via ApplicationConfigLoader:
var config = ApplicationConfigLoader.loadConfig(Path.of("absolute/path/to/config.yml")); var senderClient = ClientFactory.senderClient(config);
- set environment variable
- run client with
java -jar client-VERSION.jar [COMMAND] [OPTIONS]
SEND Example
The send command submits a new submission to a destination. Apart from optional attachments, all options are mandatory.
java -jar client-1.0-SNAPSHOT.jar send
--destinationId=1b7d1a24-a6c8-4050-bb71-ae3749ec432f
--serviceName=Test
--leikaKey=urn:de:fim:leika:leistung:99400048079000
--attachments=C:/path/to/attachments/dummy1.pdf, C:/path/to/attachments/dummy2.pdf
--data="{foo: 'bar'}"
--dataType=JSON
Hint: copy example on one line for execution !
LIST Submissions Example
The list command lists all submissionIds for a given destinationID.
java -jar client-1.0-SNAPSHOT.jar list --destinationID=1b7d1a24-a6c8-4050-bb71-ae3749ec432f
GET Single Submission Example
The get command loads a submission by submissionId
and stores data and attachments in the given target location. If no target is
set, the cmd-client saves the data into in a folder named by the submissionId
within the working dir of the runnable
jar.
java -jar client-1.0-SNAPSHOT.jar get --submissionID=cc9b9b3c-d4b1-4ac7-a70b-e7ca76e88608 --target=Users/submissions/data
Usage And Commands
Usage: <main class> [command] [command options]
Commands:
send Send a submission
Usage: send [options]
Options:
--attachments
Attachments as list of paths
Default: []
* --data
JSON or XML data as string
* --dataType
Data mime type (JSON/XML), default JSON
Default: JSON
Possible Values: [JSON, XML]
* --destinationId
Unique destination identifier - UUID format
* --leikaKey
The LeikaKey of the service type
* --serviceName
Name of the service type
list Lists available submissions
Usage: list [options]
Options:
* --destinationId
Unique destination identifier - UUID format
get Fetches one submission by id
Usage: get [options]
Options:
* --submissionId
Unique submission identifier - UUID format
--target
Target folder where attachments and data is written to
API Flow
The ClientFactory provides fluent API clients for both Sender and Subscriber.
As the flow chart below shows, the fluent client guides through all essential calls in order to hand in a correct submission as well as receive submissions on the subscriber side.
Api client flow for sending a submission
For the actual sender client those calls look like this:
Workflow | Java sample calls |
---|---|
|
|
Api client flow for subscribing to a submission
Workflow | Java sample calls |
---|---|
|
|