Skip to main content

RabbitMQ Plugin

This page explains the YAML fields from lynx-rabbitmq/conf/example_config.yml. The runtime prefix is rabbitmq, so the example can be copied into a Lynx bootstrap file without adding a lynx. parent block.

Runtime Facts

ItemValue
Go modulegithub.com/go-lynx/lynx-rabbitmq
Config prefixrabbitmq
Runtime plugin namerabbitmq
Public API shapeplugin-manager lookup to rabbitmq and rabbitmq.ClientInterface methods

YAML Walkthrough

Top-level rabbitmq

FieldWhat it controlsWhen it mattersDefault / interactionCommon misconfig
urlsRabbitMQ server URL list.Always. Startup fails if it cannot connect.The current startup path dials the first URL in the list.Assuming multiple URLs already mean active client-side failover or round-robin.
usernameUsername fallback for broker auth.Useful when you do not want credentials embedded in the URL string.Example value is guest. In practice the URL usually remains the decisive source.Setting different credentials in urls and username/password and forgetting which one ops actually rotates.
passwordPassword fallback for broker auth.Same scope as username.Example value is guest. Treat it as a secret in real deployments.Leaving the local guest password in non-local environments.
virtual_hostRabbitMQ virtual host.Every connection.Defaults to /. The connection config passes this to AMQP connect.Using the right broker credentials but the wrong vhost and reading the failure as a network issue.
dial_timeoutIntended dial timeout knob for broker connections.Connection troubleshooting and connection-SLA planning.The template shows 3s, but the current startup path does not pass this field into amqp.DialConfig.Tuning it and expecting connection attempts to shorten immediately in the current implementation.
heartbeatAMQP heartbeat interval.Long-lived connections.Defaults to 30s in the repo defaults.Setting it too low for noisy networks and creating false disconnect churn.
channel_pool_sizeIntended shared channel-pool size.Throughput planning.Example value is 10. The current client still initializes its goroutine pool with a fixed 10.Changing it and expecting publish or consume concurrency to change by itself.
producersNamed producer definitions.When the service publishes to exchanges.Each enabled producer declares its exchange during startup.Leaving all example producers enabled and accidentally booting more topology than the service needs.
consumersNamed consumer definitions.When the service consumes queues.Each enabled consumer declares its queue during startup.Assuming the template also binds queues to exchanges automatically.

rabbitmq.producers[]

FieldWhat it controlsWhen it mattersDefault / interactionCommon misconfig
nameLogical producer name used by application code.Every named publish path.Keep it stable because PublishMessageWith references it directly.Renaming it in config without updating callers or dashboards.
enabledEnables or disables one producer definition.When the service should publish through that exchange profile.Disabled entries are ignored.Carrying enabled sample producers into production by copy-paste.
exchangeExchange name the producer targets.Startup and publish paths.The startup path declares the exchange when the field is non-empty.Leaving it empty and assuming the default exchange flow matches your routing design.
exchange_typeExchange type: direct, fanout, topic, headers.Exchange declaration and routing design.The example shows all four patterns.Using fanout or headers while still expecting routing-key semantics.
routing_keyPublish routing key.Every publish call except pure fanout or header-routed flows.Keep it aligned with consumer bindings.Reusing topic-style wildcards against a direct exchange.
max_retriesIntended publish retry count.Message send error handling.Example values vary by producer. The repo retry helper currently reads producer retry settings as generic publish guidance, not exchange declaration settings.Raising it on non-idempotent business publishes without reviewing duplicate side effects.
retry_backoffIntended delay between publish retries.Message send error handling.Example values range from 100ms to 200ms.Setting it extremely low and producing retry storms during broker trouble.
publish_timeoutIntended timeout budget for publish calls.Message send paths.Example values range from 3s to 5s. It does not change exchange declaration at startup.Tuning it to solve topology declaration failures instead of publish latency.
exchange_durableWhether the exchange survives broker restarts.Exchange lifecycle planning.Example value is true. The startup path passes this into ExchangeDeclare.Setting it false for business exchanges that should persist across broker restarts.
exchange_auto_deleteWhether the exchange should auto-delete when unused.Temporary exchange designs.The template exposes it, but the current startup declaration path still uses false.Assuming changing the YAML value already changes broker-side exchange deletion behavior today.
message_persistentWhether published messages should be marked persistent.Publish durability decisions.Useful only on the actual publish path; it does not affect exchange declaration.Expecting it to keep messages safe while publishing into non-durable topology.

rabbitmq.consumers[]

FieldWhat it controlsWhen it mattersDefault / interactionCommon misconfig
nameLogical consumer name used by application code.Every named subscribe path.Keep it stable because SubscribeWith uses it directly.Renaming it in YAML while the handler still selects the old name.
enabledEnables or disables one consumer definition.When the service should be allowed to consume with that instance.Disabled entries are ignored.Assuming a disabled sample consumer can still be selected later.
queueQueue name to declare and consume.Startup and consume paths.The startup path calls QueueDeclare when the field is non-empty.Forgetting that queue existence alone does not bind it to an exchange.
exchangeIntended exchange bound to the queue.Queue topology planning.Keep it aligned with producer exchange names. The current startup path does not auto-bind the queue.Believing this YAML row alone creates the binding.
routing_keyIntended binding routing key.Queue binding design.Keep it aligned with producer publish keys. The current startup path does not call QueueBind.Tweaking it while no actual binding step exists yet.
consumer_tagBroker-facing consumer tag.Helpful for debugging live consumers.Only meaningful when a real consume loop starts.Treating it as a queue name or expecting it to create uniqueness guarantees.
max_concurrencyIntended message-handler parallelism.Consume worker design.Keep it aligned with downstream safety and ordering needs. The current startup path does not enforce it during queue declaration.Raising it while still assuming per-message ordering.
prefetch_countAMQP QoS prefetch value.Every active consumer channel.Defaults to 1; the startup path applies it with Qos.Setting a very high prefetch on slow handlers and starving other consumers.
queue_durableWhether the queue survives broker restarts.Queue lifecycle planning.Example value is true. The startup path passes it into QueueDeclare.Setting it false for service-owned business queues.
queue_auto_deleteWhether the queue auto-deletes when unused.Temporary queue designs.The template exposes it, but the current startup declaration path still uses false.Expecting the YAML switch to delete queues automatically today.
queue_exclusiveWhether the queue is exclusive to one connection.Single-consumer, private queue designs.The template exposes it, but the current startup declaration path still uses false.Assuming it already prevents other consumers from attaching.
auto_ackWhether messages are acknowledged automatically.Actual consume logic.Usually keep it false for at-least-once handling. It does not affect queue declaration.Turning it on while the handler still expects manual failure-driven redelivery.

Complete YAML Example

rabbitmq:
urls:
- amqp://guest:guest@localhost:5672/ # Current startup path dials the first URL in the list
- amqp://guest:guest@localhost:5673/ # Optional secondary broker URL for failover planning

username: guest # Fallback username when the URL does not carry credentials
password: guest # Fallback password; move to secret management outside local development
virtual_host: / # Broker virtual host; defaults to /
dial_timeout: 3s # Intended connection timeout knob in config
heartbeat: 30s # Heartbeat interval for the AMQP connection
channel_pool_size: 10 # Intended shared channel pool size

producers:
- name: default-producer # Application-facing producer name
enabled: true # Disabled entries are ignored
exchange: lynx.exchange # Exchange to declare and publish to
exchange_type: direct # direct | fanout | topic | headers
routing_key: lynx.routing.key # Ignored by pure fanout exchanges
max_retries: 3 # Intended publish retry count
retry_backoff: 100ms # Intended retry backoff between publish attempts
publish_timeout: 3s # Intended publish timeout
exchange_durable: true # Keep true for business exchanges
exchange_auto_delete: false # Auto-delete only for temporary exchanges
message_persistent: true # Persistent message delivery hint

consumers:
- name: default-consumer # Application-facing consumer name
enabled: true # Disabled entries are ignored
queue: lynx.queue # Queue to declare and consume
exchange: lynx.exchange # Expected exchange bound to the queue
routing_key: lynx.routing.key # Expected binding key
consumer_tag: lynx.consumer # Broker-facing consumer tag
max_concurrency: 4 # Intended message-handler concurrency
prefetch_count: 10 # QoS prefetch count applied at startup
queue_durable: true # Keep true for service-owned business queues
queue_auto_delete: false # Auto-delete only for temporary queues
queue_exclusive: false # Exclusive queues cannot be shared
auto_ack: false # false preserves at-least-once handling semantics

Minimum Viable YAML Example

rabbitmq:
urls:
- amqp://guest:guest@localhost:5672/
producers:
- name: default-producer
enabled: true
exchange: lynx.exchange
exchange_type: direct

Source Template

  • lynx-rabbitmq/conf/example_config.yml

How To Consume It

plugin := lynx.Lynx().GetPluginManager().GetPlugin("rabbitmq")
client := plugin.(rabbitmq.ClientInterface)

Use the named producer and consumer APIs exposed by rabbitmq.ClientInterface after resolving the plugin from the runtime.