activemq

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

README

Conduit Connector for Activemq Artemis

The ActiveMQ Classic connector is one of Conduit plugins. The connector provides both a source and a destination connector for ActiveMQ Artemis.

It uses the stomp protocol to connect to ActiveMQ.

What data does the OpenCDC record consist of?

  • record.Position: json object with the destination and the messageId frame header.
  • record.Operation: currently fixed as "create".
  • record.Metadata: a string to string map, with keys prefixed as activemq.header.{STOMP_HEADER_NAME}.
  • record.Key: the messageId frame header.
  • record.Payload.Before: empty
  • record.Payload.After: the message body

How to build?

Run make build to build the connector.

Testing

Run make test to run all the tests. The command will handle starting and stopping docker containers for you.

Source configuration

version: 2.2
pipelines:
  - id: example
    status: running
    connectors:
      - id: example
        plugin: "activemq"
        settings:
          # The name of the STOMP destination.
          # Type: string
          # Required: yes
          destination: ""
          # The password to use when connecting to the broker.
          # Type: string
          # Required: yes
          password: ""
          # The URL of the ActiveMQ Artemis broker.
          # Type: string
          # Required: yes
          url: ""
          # The username to use when connecting to the broker.
          # Type: string
          # Required: yes
          user: ""
          # The size of the consumer window. It maps to the
          # "consumer-window-size" header in the STOMP SUBSCRIBE frame.
          # Type: string
          # Required: no
          consumerWindowSize: "-1"
          # The minimum amount of time between the client expecting to receive
          # heartbeat notifications from the server.
          # Type: duration
          # Required: no
          recvTimeoutHeartbeat: "2s"
          # The maximum amount of time between the client sending heartbeat
          # notifications from the server.
          # Type: duration
          # Required: no
          sendTimeoutHeartbeat: "2s"
          # The subscription type. It can be either ANYCAST or MULTICAST, with
          # ANYCAST being the default. Maps to the "subscription-type" header in
          # the STOMP SUBSCRIBE frame.
          # Type: string
          # Required: no
          subscriptionType: "ANYCAST"
          # The path to the CA certificate file.
          # Type: string
          # Required: no
          tls.caCertPath: ""
          # The path to the client certificate file.
          # Type: string
          # Required: no
          tls.clientCertPath: ""
          # The path to the client key file.
          # Type: string
          # Required: no
          tls.clientKeyPath: ""
          # Flag to enable or disable TLS.
          # Type: bool
          # Required: no
          tls.enabled: "false"
          # Flag to disable server certificate verification.
          # Type: bool
          # Required: no
          tls.insecureSkipVerify: "false"
          # Maximum delay before an incomplete batch is read from the source.
          # Type: duration
          # Required: no
          sdk.batch.delay: "0"
          # Maximum size of batch before it gets read from the source.
          # Type: int
          # Required: no
          sdk.batch.size: "0"
          # Specifies whether to use a schema context name. If set to false, no
          # schema context name will be used, and schemas will be saved with the
          # subject name specified in the connector (not safe because of name
          # conflicts).
          # Type: bool
          # Required: no
          sdk.schema.context.enabled: "true"
          # Schema context name to be used. Used as a prefix for all schema
          # subject names. If empty, defaults to the connector ID.
          # Type: string
          # Required: no
          sdk.schema.context.name: ""
          # Whether to extract and encode the record key with a schema.
          # Type: bool
          # Required: no
          sdk.schema.extract.key.enabled: "true"
          # The subject of the key schema. If the record metadata contains the
          # field "opencdc.collection" it is prepended to the subject name and
          # separated with a dot.
          # Type: string
          # Required: no
          sdk.schema.extract.key.subject: "key"
          # Whether to extract and encode the record payload with a schema.
          # Type: bool
          # Required: no
          sdk.schema.extract.payload.enabled: "true"
          # The subject of the payload schema. If the record metadata contains
          # the field "opencdc.collection" it is prepended to the subject name
          # and separated with a dot.
          # Type: string
          # Required: no
          sdk.schema.extract.payload.subject: "payload"
          # The type of the payload schema.
          # Type: string
          # Required: no
          sdk.schema.extract.type: "avro"

Destination configuration

version: 2.2
pipelines:
  - id: example
    status: running
    connectors:
      - id: example
        plugin: "activemq"
        settings:
          # The name of the STOMP destination.
          # Type: string
          # Required: yes
          destination: ""
          # The password to use when connecting to the broker.
          # Type: string
          # Required: yes
          password: ""
          # The URL of the ActiveMQ Artemis broker.
          # Type: string
          # Required: yes
          url: ""
          # The username to use when connecting to the broker.
          # Type: string
          # Required: yes
          user: ""
          # The "destination" header in the STOMP SEND frame. Useful when using
          # ANYCAST.
          # Type: string
          # Required: no
          destinationHeader: ""
          # The routing type of the destination. It can be either ANYCAST or
          # MULTICAST, with ANYCAST being the default. Maps to the
          # "destination-type" header in the STOMP SEND frame.
          # Type: string
          # Required: no
          destinationType: "ANYCAST"
          # The minimum amount of time between the client expecting to receive
          # heartbeat notifications from the server.
          # Type: duration
          # Required: no
          recvTimeoutHeartbeat: "2s"
          # The maximum amount of time between the client sending heartbeat
          # notifications from the server.
          # Type: duration
          # Required: no
          sendTimeoutHeartbeat: "2s"
          # The path to the CA certificate file.
          # Type: string
          # Required: no
          tls.caCertPath: ""
          # The path to the client certificate file.
          # Type: string
          # Required: no
          tls.clientCertPath: ""
          # The path to the client key file.
          # Type: string
          # Required: no
          tls.clientKeyPath: ""
          # Flag to enable or disable TLS.
          # Type: bool
          # Required: no
          tls.enabled: "false"
          # Flag to disable server certificate verification.
          # Type: bool
          # Required: no
          tls.insecureSkipVerify: "false"
          # Maximum delay before an incomplete batch is written to the
          # destination.
          # Type: duration
          # Required: no
          sdk.batch.delay: "0"
          # Maximum size of batch before it gets written to the destination.
          # Type: int
          # Required: no
          sdk.batch.size: "0"
          # Allow bursts of at most X records (0 or less means that bursts are
          # not limited). Only takes effect if a rate limit per second is set.
          # Note that if `sdk.batch.size` is bigger than `sdk.rate.burst`, the
          # effective batch size will be equal to `sdk.rate.burst`.
          # Type: int
          # Required: no
          sdk.rate.burst: "0"
          # Maximum number of records written per second (0 means no rate
          # limit).
          # Type: float
          # Required: no
          sdk.rate.perSecond: "0"
          # The format of the output record. See the Conduit documentation for a
          # full list of supported formats
          # (https://conduit.io/docs/using/connectors/configuration-parameters/output-format).
          # Type: string
          # Required: no
          sdk.record.format: "opencdc/json"
          # Options to configure the chosen output record format. Options are
          # normally key=value pairs separated with comma (e.g.
          # opt1=val2,opt2=val2), except for the `template` record format, where
          # options are a Go template.
          # Type: string
          # Required: no
          sdk.record.format.options: ""
          # Whether to extract and decode the record key with a schema.
          # Type: bool
          # Required: no
          sdk.schema.extract.key.enabled: "true"
          # Whether to extract and decode the record payload with a schema.
          # Type: bool
          # Required: no
          sdk.schema.extract.payload.enabled: "true"

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Connector = sdk.Connector{
	NewSpecification: sdk.YAMLSpecification(specs, version),
	NewSource:        NewSource,
	NewDestination:   NewDestination,
}

Functions

func NewDestination

func NewDestination() sdk.Destination

func NewSource

func NewSource() sdk.Source

Types

type Config

type Config struct {
	// The URL of the ActiveMQ Artemis broker.
	URL string `json:"url" validate:"required"`

	// The username to use when connecting to the broker.
	User string `json:"user" validate:"required"`

	// The password to use when connecting to the broker.
	Password string `json:"password" validate:"required"`

	// The name of the STOMP destination.
	Destination string `json:"destination" validate:"required"`

	// The maximum amount of time between the
	// client sending heartbeat notifications from the server.
	SendTimeoutHeartbeat time.Duration `json:"sendTimeoutHeartbeat" default:"2s"`

	// The minimum amount of time between the client expecting to receive
	// heartbeat notifications from the server.
	RecvTimeoutHeartbeat time.Duration `json:"recvTimeoutHeartbeat" default:"2s"`

	TLS TLSConfig `json:"tls"`
}

type Destination

type Destination struct {
	sdk.UnimplementedDestination
	// contains filtered or unexported fields
}

func (*Destination) Config

func (d *Destination) Config() sdk.DestinationConfig

func (*Destination) Open

func (d *Destination) Open(ctx context.Context) (err error)

func (*Destination) Teardown

func (d *Destination) Teardown(ctx context.Context) error

func (*Destination) Write

func (d *Destination) Write(ctx context.Context, records []opencdc.Record) (int, error)

type DestinationConfig

type DestinationConfig struct {
	Config

	sdk.DefaultDestinationMiddleware

	// The routing type of the destination. It can be either ANYCAST or
	// MULTICAST, with ANYCAST being the default.
	// Maps to the "destination-type" header in the STOMP SEND frame.
	DestinationType string `json:"destinationType" default:"ANYCAST" validation:"inclusion=ANYCAST|MULTICAST"`

	// The "destination" header in the STOMP SEND frame. Useful when using
	// ANYCAST.
	DestinationHeader string `json:"destinationHeader"`
}

type Position

type Position struct {
	MessageID   string `json:"message_id"`
	Destination string `json:"destination"`
}

func (Position) ToSdkPosition

func (p Position) ToSdkPosition() opencdc.Position

type Source

type Source struct {
	sdk.UnimplementedSource
	// contains filtered or unexported fields
}

func (*Source) Ack

func (s *Source) Ack(ctx context.Context, position opencdc.Position) error

func (*Source) Config

func (s *Source) Config() sdk.SourceConfig

func (*Source) Open

func (s *Source) Open(ctx context.Context, sdkPos opencdc.Position) (err error)

func (*Source) Read

func (s *Source) Read(ctx context.Context) (opencdc.Record, error)

func (*Source) Teardown

func (s *Source) Teardown(ctx context.Context) error

type SourceConfig

type SourceConfig struct {
	Config

	sdk.DefaultSourceMiddleware

	// The size of the consumer window.
	// It maps to the "consumer-window-size" header in the STOMP SUBSCRIBE frame.
	ConsumerWindowSize string `json:"consumerWindowSize" default:"-1"`

	// The subscription type. It can be either ANYCAST or MULTICAST, with
	// ANYCAST being the default.
	// Maps to the "subscription-type" header in the STOMP SUBSCRIBE frame.
	SubscriptionType string `json:"subscriptionType" default:"ANYCAST" validation:"inclusion=ANYCAST|MULTICAST"`
}

type TLSConfig

type TLSConfig struct {
	// Flag to enable or disable TLS.
	Enabled bool `json:"enabled" default:"false"`

	// The path to the client key file.
	ClientKeyPath string `json:"clientKeyPath"`

	// The path to the client certificate file.
	ClientCertPath string `json:"clientCertPath"`

	// The path to the CA certificate file.
	CaCertPath string `json:"caCertPath"`

	// Flag to disable server certificate verification.
	InsecureSkipVerify bool `json:"insecureSkipVerify" default:"false"`
}

Directories

Path Synopsis
cmd
connector command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL