Skip to content
Snippets Groups Projects
README.md 1.84 KiB
Newer Older
## Client Module

### API Flow

The ClientFactory provides fluent API clients both for **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:


<table>
<tr>
<th>Workflow</th>
<th>Java sample calls</th>
</tr>
<tr>
<td>

```mermaid

flowchart TD

A[Create Client] --> B(Provide DestinationID)
B -->|next| C[Add Attachments]
C -->|send| D[SubmissionForPickup]
C -->|next| E[Add Data]
E -->|send| D[SubmissionForPickup]
```

</td>
<td>

```java

List<File> attachments...

// Send without data
        ClientFactory.senderClient()
        .withDestination(UUID.randomUUID())
        .withAttachments(attachments)
        .submit();

// Send with data
        ClientFactory.senderClient()
        .withDestination(UUID.randomUUID())
        .withAttachments(attachments)
        .withData("some json or xml content")
        .submit();
```

</td>
</tr>
</table>

#### Api client flow for subscribing to a submission

<table>
<tr>
<th>Workflow</th>
<th>Java sample calls</th>
</tr>
<tr>
<td>

```mermaid
flowchart TD

A[Create Client] --> B(Poll List ofAvailable Submissions)
A[Create Client] --> C(Request Submission by ID)
B -->|next| C[Request Submission by ID]
C -->|get| D[Attachments]
C -->|get| E[Metadata]
C -->|get| F[Data]

```

</td>
<td>

```java

    var client = ClientFactory.subscriberClient();

    var submissions = client.getAvailableSubmissions(destinationId);
    // filter submission list for requested one ...
            
    var submission = client.requestSubmission(submissionId)
    submission.getAttachments();
    submission.getMetadata();
    submission.getData();
```

</td>
</tr>
</table>