---
name: "zeromq-pubsub-sockets-pattern"
description: "Build brokerless, peer-to-peer distributed messaging pipelines using ZeroMQ sockets."
metadata:
  author: "ZeroMQ"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "implement zeromq pub sub"
  - "create zeromq router dealer broker"
  - "zeromq ipc inter-process"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# ZeroMQ High-Speed Socket Patterns & Messaging

Implements ZeroMQ architectural patterns: PUB-SUB subscription filtering, PUSH-PULL pipeline parallelization, ROUTER-DEALER asynchronous request-reply brokers, and inproc/ipc/tcp transport protocols.

## When to Invoke
Invoke this skill whenever you need to:
- implement zeromq pub sub
- create zeromq router dealer broker
- zeromq ipc inter-process

## Execution SOP & Rules
1. Initialize context: context = zmq.Context().
2. Bind publisher socket: pub = context.socket(zmq.PUB); pub.bind('tcp://*:5555').
3. Subscribe with prefix filter: sub = context.socket(zmq.SUB); sub.setsockopt_string(zmq.SUBSCRIBE, 'market_data').
4. Use zmq.Poller to multiplex multiple sockets and avoid blocking event loops.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
