Sign inSign up

wilddev/rabbitmq-cron

By wilddev

•Updated 11 months ago

RabbitMQ based cron events emitter service

Image
0

928

wilddev/rabbitmq-cron repository overview

⁠Quick reference

⁠Supported tags

⁠Overview

RabbitMQ based cron events emitter service. It is not supposed to be scalable, so you need to run only one auto-restart replica.

Well-suited for small and medium-sized apps.

⁠How it works:

  1. Build & Run
  2. Fork it by creation of any queue
  3. Bind the queue to scheduler exchange with a predefined routing key (e.g. minute or second)


Sample new-items-poll-tick-queue configuration:

rabbitmqadmin declare queue name=new-items-poll-tick-queue durable=false
rabbitmqadmin declare binding source=scheduler destination_type=queue destination=new-items-poll-tick-queue routing_key=minute

An example message to be emitted:

Exchange 	scheduler
Routing Key 	minute
...
headers:	
content_encoding:	UTF-8
content_type:	application/json
...
Payload
Encoding: string

{"timestamp":"2024-09-24 10:00:00"}

⁠Get started

The basic run example:

docker run -d -e RABBIT_HOST=rabbitmq -e RABBIT_USER=guest -e RABBIT_PASS=guest wilddev/rabbitmq-cron:latest

Deploy it in a Swarm:

version: "3.9"
services:
  rabbitmq-cron:
    image: wilddev/rabbitmq-cron:latest
    restart: unless-stopped
    environment:
      - RABBIT_HOST=rabbitmq
      - RABBIT_USER=guest
      - RABBIT_PASS=guest
    networks:
      overlay:
        aliases:
          - rabbitmq-cron
...

Available settings list and their default values:

JAVA_OPTS=-Xmx256M
RABBIT_HOST=rabbitmq
RABBIT_USER=guest
RABBIT_PASS=guest
RABBIT_PORT=5672
SERVER_PORT=8080

⁠Notes

Ensure that this service is initially started before other dependent services, as it creates durable scheduler exchange

Tag summary

Content type

Image

Digest

sha256:ca214c6c5…

Size

106.8 MB

Last updated

11 months ago

docker pull wilddev/rabbitmq-cron:1.0.0-SNAPSHOT