diff --git a/benthos/benthos.yaml b/benthos/benthos.yaml new file mode 100644 index 0000000..13ba217 --- /dev/null +++ b/benthos/benthos.yaml @@ -0,0 +1,40 @@ +input: + label: cic_chain_events + nats_jetstream: + urls: + - nats://localhost:4222 + subject: CHAIN.transfer + durable: benthos_sub + stream: CHAIN + deliver: all +pipeline: + processors: + - label: event_transformer + bloblang: | + root = this + root.timestamp = (this.timestamp).ts_format() + root.txType = if this.txType == "transfer" { + "TRANSFER" + } else if this.txType == "mintTo" { + "MINT_TO" + } else { + "TRANSFER_FROM" + } +output: + broker: + outputs: + - label: webhooks + http_client: + url: "https://webhook.site/ab61ace1-52bf-4495-a11a-4630a2a7cb6f" + verb: POST + timeout: 5s + - label: logg + stdout: + codec: lines + +logger: + level: DEBUG + format: logfmt + add_timestamp: false + static_fields: + '@service': benthos \ No newline at end of file diff --git a/benthos/sample_request.txt b/benthos/sample_request.txt new file mode 100644 index 0000000..c66fe41 --- /dev/null +++ b/benthos/sample_request.txt @@ -0,0 +1,12 @@ +{ + "block": 20884999, + "contractAddress": "0x8Bab657c88eb3c724486D113E650D2c659aa23d2", + "from": "0xc0876400F9D0dAA9554fFD232A322E6E6A0CCF04", + "success": true, + "timestamp": "2023-08-15T17:57:41+08:00", + "to": "0x8f045f2F97724B7C73BC009241D84975b76951bA", + "transactionHash": "0x01ab13f2d840fdfcc016d1e1f42f1f28b6413c821fcc479030e99f9cfa0a298d", + "transactionIndex": 15, + "txType": "TRANSFER", + "value": 1000000 +} \ No newline at end of file