Skip to content

Use pipelines as a base #12

@alersrt

Description

@alersrt

Instead of splitting plugins on producers and consumers, it's better to consider pipelines — read input and produce output.

Config then would looks like:

plugins:
  - name: imap
    bin: ./build/bin/imap-plugin.so
  - name: telegram
    bin: ./build/bin/telegram-plugin.so

pipelines:
  - name: imap
    plugin: imap
    conf:
      url: ${WOMBAT_IMAP_ADDRESS:-mail.dev:993}
      username: ${WOMBAT_IMAP_USERNAME:-example@mail.dev}
      password: ${WOMBAT_IMAP_PASSWORD:-password}
      mailbox: ${WOMBAT_IMAP_MAILBOX:-Inbox}
      idleTimeout: ${WOMBAT_IMAP_IDLE_TIMEOUT:-5000}
      verbose: ${WOMBAT_IMAP_VERBOSE:-true}
  - name: tg
    plugin: telegram
    conf:
      token: ${WOMBAT_TELEGRAM_TOKEN:-example}

rules:
  - name: imap_to_tg
    producer: imap
    consumer: tg
    filter: 'true'
    transform: |
      {
        "chat_id": 1234,
        "content": self.?envelope.?subject
      }
  - name: tg_to_tg
    producer: tg
    consumer: tg
    filter: |
      self.chat_id == 1234
    transform: |
      {
        "chat_id": 4321,
        "content": self.content
      }
    

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions