Document the unmarshaller api
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
d418789764
commit
68c384ed5b
23
README.md
23
README.md
|
@ -378,6 +378,29 @@ Promise Receiver.listen()
|
||||||
Receiver.stop()
|
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)
|
> 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)
|
> Learn about [Builder Design Pattern](https://en.wikipedia.org/wiki/Builder_pattern)
|
||||||
|
|
Loading…
Reference in New Issue