MongoDB

Overview

MongoDB publisher transport emits processed events into a defined database collection. Events are serialised using either the provided Document Formatter serializer or a custom transformer implementation.

Driver details

org.mongodb:mongodb-driver-sync:4.8.1

Example

mongodbPublisher:
  servers:
    localhost: 27017
  enable ssl: false

  database: customerdb
  collection: emea_customers
  ordered inserts: true

  credentials:
    user: joule
    password: password
    mechanism: SCRAM_SHA_1

  serializer:
    batch: false
    formatter:
      documentFormatter:
        contentType: application/octet-stream
        encoding: base64

Attributes schema

Configuration parameters available for the MongDB publisher transport.

AttributeDescriptionData TypeRequired

database

Name of database

String

collection

Name of collection inserts will be applied to

String

ordered inserts

Hint to MongDB to insert documents using presented ordering

Boolean

Default: true

servers

Map of servers with associated ports

Map<String,Integer>

enable ssl

Enable SSL

boolean

Default: false

credentials

Credential configuration

See Credential Attributes section

serializer

Serialization configuration

See Serialization Attributes section

Credential Attributes

AttributeDescriptionData TypeRequired

username

Username

String

password

password

String

authenication database

Database to use to authenicate connected user

String

Default: admin

mechanism

Authenication mechanism

Options

  • PLAIN

  • SCRAM_SHA_1

  • SCRAM_SHA_256

String

Default: SCRAM_SHA_1

Serialization Attributes

This topic provides configuration parameters available object serialization process.

AttributeDescriptionData TypeRequired

transform

User provided implementation

CustomTransformer

formatter

This is used when a custom transformer is not provided. Useful when chaining Joule processes

Formatter

Default: documentFormatter (See Document Formatter)

contentType

Type of content to inform receiving application

String

Default: application/octet-stream

encoding

Payload encoding method

String

Default: base64

batch

Flag to batch multiple messages in to a single payload

Boolean

Default: false

Serializer example

The configuration below will serialize StreamEvents as MongoDB documents.

serializer:
  batch: false
  formatter:
    documentFormatter:
      contentType: application/octet-stream
      encoding: base64

Document Formatter

Joule ships with a MongoDB document formatter which converts a StreamEvents in to a MongoDB Document type.

Further details

Last updated