Skip to content
A small binary that can be used to simulate data providers bound to a RabbitMq server.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dockerignore
.gitignore
Dockerfile
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
fakedata.go

README.md

Fake Data Provider for RabbitMQ

This small program connects to a given RabbitMQ server, declares a topic where to which it binds a queue on which it consumes so called query messages. Concrete names for exchange, queue and routing key used to bind the queue have to be configured in a file config.properties.

The query messages need to provide a reply_to property that contains an AMQP address to which the response message shall be sent. The format is [exchange_name]/[routing_key] or just [exchange_name].

The program will not fill the response with any dynamic data but with the contents of a file found at the configured filename.

Installation

Simply call

go get github.com/rjayasinghe/fakedata

or clone the repository and call

go build fakedata.go

Configuration

You will need a configuration file that is named config.properties:

rabbitmq.port=5672
rabbitmq.hostname=localhost
rabbitmq.username=guest
rabbitmq.password=guest
rabbitmq.queries.exchange=queries //how the queries exchange is named
rabbitmq.queries.queue=fakedata.queries //which queue shall be created for this fakedata instance
rabbitmq.queries.routingkey=orders.all //which routing key is used to bind the created queue
rabbitmq.timeout=5s //how long to wait after a connection failure
filename=orders.json //the name of the datafile

Containerization

If you are running your data consuming application in a container environment it is obvious to run this program in a container itself.

Configuration and data files are need to reside in the same directory as the executable itself. In a docker-compose scenario you'd mount as volumes like this:

    volumes:
        - ./docker/fakedata-orders/config.properties:/config.properties
        - ./docker/fakedata-orders/orders.json:/orders.json

TODO

  • Tests ;-)
You can’t perform that action at this time.