Document the unmarshaller api

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-06-20 21:36:17 -03:00
parent d418789764
commit 68c384ed5b
1 changed files with 23 additions and 0 deletions

View File

@ -378,6 +378,29 @@ Promise Receiver.listen()
Receiver.stop()
```
### `Unmarshaller` classes
The Unmarshaller classes uses the receiver API, abstracting the formats:
- structured
- binary
Choosing the right implementation based on the `headers` map.
```js
/*
* Constructor without arguments
*/
Unmarshaller()
/*
* The method to unmarshall the payload.
* @arg payload could be a string or a object
* @arg headers a map of headers
*/
Promise Unmarshaller.unmarshall(payload, headers)
```
> See how to implement the method injection [here](lib/specs/spec_0_1.js#L17)
>
> Learn about [Builder Design Pattern](https://en.wikipedia.org/wiki/Builder_pattern)