Skip to content

mod_external_filter

Module Description

This module enables message filtering through an external service. It uses a configured HTTP pool to manage outgoing connections.

The external service has to be a GraphQL server with the schema described in the next section.

GraphQL server schema

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
type RootMutation {
    verifyMessage(
        body: String!
        rawMessage: String
        externalId: String!
        recipient: String!
        sender: String!
    ): VerificationResult
}

type VerificationResult {
    action: Action!
}

enum Action {
    # The message can be routed
    ALLOW
    # The message should not be routed
    BLOCK
}

Options

modules.mod_external_filter.pool_tag

  • Syntax: string
  • Default: no default, this option is mandatory
  • Example: pool_tag = "graphql_filter"

An http pool tag that is configured in outgoing connections section. E.g.

1
2
3
4
5
6
7
[outgoing_pools.http.filter_service]
  scope = "host_type"
  workers = 30

  [outgoing_pools.http.filter_service.connection]
    host = "http://localhost:8080"
    path_prefix = "/api"

Example configuration

1
2
[modules.mod_external_filter]
  pool_tag = "graphql_filter"