Module: PGMQ

Defined in:
lib/pgmq.rb,
lib/pgmq/client.rb,
lib/pgmq/errors.rb,
lib/pgmq/message.rb,
lib/pgmq/metrics.rb,
lib/pgmq/version.rb,
lib/pgmq/connection.rb,
lib/pgmq/transaction.rb,
lib/pgmq/client/topics.rb,
lib/pgmq/client/metrics.rb,
lib/pgmq/queue_metadata.rb,
lib/pgmq/client/consumer.rb,
lib/pgmq/client/producer.rb,
lib/pgmq/client/maintenance.rb,
lib/pgmq/client/multi_queue.rb,
lib/pgmq/client/queue_management.rb,
lib/pgmq/client/message_lifecycle.rb

Overview

PGMQ - Low-level Ruby client for Postgres Message Queue

This is a low-level library providing direct access to PGMQ operations. For higher-level abstractions, job processing, and framework integrations, see pgmq-framework (similar to how rdkafka-ruby relates to Karafka).

Examples:

Basic usage

require 'pgmq'

# Create client with connection parameters
client = PGMQ::Client.new(
  host: 'localhost',
  port: 5432,
  dbname: 'mydb',
  user: 'postgres',
  password: 'postgres'
)

# Or with connection string
client = PGMQ::Client.new('postgres://localhost/mydb')

# Basic queue operations
client.create('orders')
msg_id = client.produce('orders', '{"order_id":123}')
msg = client.read('orders', vt: 30)
client.delete('orders', msg.msg_id)
client.drop_queue('orders')

Defined Under Namespace

Modules: Errors, Transaction Classes: Client, Connection, Message, Metrics, QueueMetadata

Constant Summary collapse

VERSION =

Current version of the pgmq-ruby gem

"0.6.1"

Class Method Summary collapse

Class Method Details

.newPGMQ::Client

Convenience method to create a new client

Examples:

client = PGMQ.new('postgres://localhost/mydb')

Returns:

See Also:



49
50
51
# File 'lib/pgmq.rb', line 49

def new(*, **)
  Client.new(*, **)
end