ts example with binary emitter
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
625e927ae1
commit
0d8c8a13ae
|
@ -1,4 +1,4 @@
|
||||||
import Cloudevent, { event, StructuredHTTPEmitter } from 'cloudevents-sdk/v1';
|
import Cloudevent, { event, StructuredHTTPEmitter, BinaryHTTPEmitter } from 'cloudevents-sdk/v1';
|
||||||
|
|
||||||
export function doSomeStuff() {
|
export function doSomeStuff() {
|
||||||
|
|
||||||
|
@ -17,15 +17,23 @@ export function doSomeStuff() {
|
||||||
url : "https://enu90y24i64jp.x.pipedream.net/"
|
url : "https://enu90y24i64jp.x.pipedream.net/"
|
||||||
};
|
};
|
||||||
|
|
||||||
let emitter = new StructuredHTTPEmitter(config);
|
let structured = new StructuredHTTPEmitter(config);
|
||||||
emitter.emit(myevent).then(res => {
|
structured.emit(myevent).then(res => {
|
||||||
// success
|
// success
|
||||||
console.log("Success!")
|
console.log("Structured Mode: Success!")
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
// error
|
// error
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
let binary = new BinaryHTTPEmitter(config);
|
||||||
|
binary.emit(myevent).then(res => {
|
||||||
|
console.log("Binary Mode: Success!");
|
||||||
})
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue